Click here to Skip to main content
15,867,488 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
AnswerRe: How to use bluetooth to pass simple ASCII serial data ? Pin
Eddy Vluggen29-Dec-22 8:42
professionalEddy Vluggen29-Dec-22 8:42 
QuestionOverall System Speed Performance Difference DDR3 vs DDR4 Pin
BernardIE531713-Dec-22 12:15
BernardIE531713-Dec-22 12:15 
AnswerRe: Overall System Speed Performance Difference DDR3 vs DDR4 Pin
Richard MacCutchan13-Dec-22 23:16
mveRichard MacCutchan13-Dec-22 23:16 
AnswerRe: Overall System Speed Performance Difference DDR3 vs DDR4 Pin
tugrulGtx17-Dec-22 8:18
tugrulGtx17-Dec-22 8:18 
QuestionTrying to use GPU detection, Google has failed me. Pin
Jordan Reardon7-Dec-22 12:43
Jordan Reardon7-Dec-22 12:43 
QuestionNetwork questions Pin
Joan M24-Nov-22 0:53
professionalJoan M24-Nov-22 0:53 
AnswerRe: how to identify the " selected text highlights" event ? Pin
trønderen21-Nov-22 8:16
trønderen21-Nov-22 8:16 
GeneralRe: how to identify the " selected text highlights" event ? Pin
trønderen22-Nov-22 4:25
trønderen22-Nov-22 4:25 
Member 14968771 wrote:
Your analogy is plausible, however, it does not explain how clicking on the text highlights it – if it is "gone" / does not exist per your explanation.
It does not exist in your application (well, your application may still have the original, from which a copy was sent to xterm, but that is a different object). But xterm saves in its own buffer the output it receives from the application. It uses the contents of the buffer to redraw the window, say, if you resize it, or scroll the text up and down.

This text buffer belongs to xterm. It is not accessible to your application. The highlighting is done in this buffer, by xterm.

All you input and output goes through xterm (as long as your focus is in the xterm window). xterm knows where you click your mouse, and knows the size of character cells in its window (they are all the same, at least in classic xterm). Calculating from the mouse coordinates which character cell was clicked is trivial. (If you use variable-width font, it is just semi-trivial.) xterm starts at from this character and looks at the preceding and following characters in its text buffer. As long as they are 'word characters', it adds highlight to it and searches forward, but stops on whitespace, punctuation etc.

If you could monitor the connection between xterm and your application when you mark the word, you would see none. The marking is something xterm does for itself, alone.

I haven't been working with xterm for a number of years, and don't remember all the details, but like most *nix-born applications, it has a ton of options. I guess that you can tell xterm to give you all the raw input - certainly from the keyboard, so that your application can interpret copy (mark) and paste keystrokes, but maybe even mouse input. Your problem is that xterm manages its own scrolling, word wrapping etc. and your application cannot know where it has placed the output text you gave it. So even if you get the mouse click position, you don't have the information to know which word the cursor was pointing at.

If I understand your need correctly (and you do not want to give your application its own tailor made X-based user interface), the simple but somewhat pedal driven way to do it is to open a text editor with a new empty file (or one where you want to add another log record), mark the text in your xterm window, and then past them into the file in the text editor. There are multiple ways to mark text in xterm - single, double, triple click, mouse drag etc.

By *nix conventions marked text is put into the copy&paste buffer. I believe (not 100% sure) that even the Windows version of xterm is *nix like; it doesn't require any ctrl-C to copy the text. Pasting into the text editor file (or any other *nix style application) is usually done with the middle mouse button (or left, if you have no middle). If you run in Windows environment, and the text editor is a Windows application, be prepared to use ctrl-V or some menu selection to paste the text.

And again: If you monitor the communication between your application and xterm, there is no trace of the copy&paste into the text editor file. The copying is a private matter between xterm and the editor.

If you have as a requirement that your application must be aware of the copy&paste, you have to abandon xterm and straight command line output, and give your application its own X-based GUI. That will complicate it significantly. If you go for that solution, do not attempt to program at the X.11 level - that is like 'GUI assembly coding'. Find some X.11 based library / GUI platform. I haven't made a *nix GUI since Motif was the standard library, but most likely, today it has competition from about 42 alternative libraries, all open source, free for you to study the source code Smile | :)
AnswerRe: how to identify the " selected text highlights" event ? Pin
Gerry Schmitz21-Nov-22 10:02
mveGerry Schmitz21-Nov-22 10:02 
AnswerRe: how to identify the " selected text highlights" event ? Pin
Richard MacCutchan21-Nov-22 21:43
mveRichard MacCutchan21-Nov-22 21:43 
AnswerRe: Linux Ubuntu grub issues - how to resolve ? Pin
Gerry Schmitz26-Aug-22 9:02
mveGerry Schmitz26-Aug-22 9:02 
AnswerRe: Linux Ubuntu grub issues - how to resolve ? Pin
Richard MacCutchan26-Aug-22 22:02
mveRichard MacCutchan26-Aug-22 22:02 
AnswerRe: bluetoothctl command - how to disable it ? (terminate command ) Pin
Dave Kreskowiak26-Aug-22 8:56
mveDave Kreskowiak26-Aug-22 8:56 
QuestionHow to list all devices on network Pin
HarryRIchard24-Aug-22 17:37
HarryRIchard24-Aug-22 17:37 
AnswerRe: How to list all devices on network Pin
Dave Kreskowiak24-Aug-22 17:55
mveDave Kreskowiak24-Aug-22 17:55 
GeneralRe: How to list all devices on network Pin
Wayne Cannon 202125-Aug-22 13:01
Wayne Cannon 202125-Aug-22 13:01 
GeneralRe: How to list all devices on network Pin
Dave Kreskowiak25-Aug-22 16:51
mveDave Kreskowiak25-Aug-22 16:51 
GeneralRe: How to list all devices on network Pin
PIEBALDconsult25-Aug-22 13:02
mvePIEBALDconsult25-Aug-22 13:02 
AnswerRe: How to list all devices on network Pin
Gerry Schmitz26-Aug-22 8:52
mveGerry Schmitz26-Aug-22 8:52 
AnswerRe: Linux Ubuntu boot from "Ubuntu" file - what is the name of it ? Pin
Richard MacCutchan24-Aug-22 21:42
mveRichard MacCutchan24-Aug-22 21:42 
Questiondata storage on aero planes Pin
Calin Negru20-Aug-22 3:54
Calin Negru20-Aug-22 3:54 
AnswerRe: data storage on aero planes Pin
Gerry Schmitz20-Aug-22 12:42
mveGerry Schmitz20-Aug-22 12:42 
GeneralRe: data storage on aero planes Pin
Calin Negru20-Aug-22 20:33
Calin Negru20-Aug-22 20:33 
AnswerRe: Dissect Linux multiboot system Pin
Richard MacCutchan16-Aug-22 21:40
mveRichard MacCutchan16-Aug-22 21:40 
GeneralRe: Dissect Linux multiboot system Pin
trønderen17-Aug-22 5:46
trønderen17-Aug-22 5:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.