It's much more difficult to write some docs than to write a code! :) 
But here it comes... 
 
I attach gzipped patch to 0.17.1 CVS branch which implements following 
features in curses version of tn5250: 
 
1. Turning crosshair on and off with Ctrl-H - small but usefull 
 
(side note - does anyone turn off USE_OWN_KEY_PARSING when compiling? 
Can we get rid of the old method? It's kind of confusing when adding new 
keys...) 
 
CAUTION: To activate mouse functionality described below you have to specify 
+mouse_handling option in program call or configuration file. With this option  
mouse events in xterm are handled by our program. Without it mouse is 
handled as it was before. 
 
2. Moving cursor with mouse click 
 
To move cursor you have to press and release mouse btn1 at selected 
position.  
 
3. Selecting, copying and pasting of rectangular region with mouse 
 
To select a region with mouse you have to press mouse btn1 at one region 
corner, drag to an oposit selection corner and release the button. When 
dragging selection area is reversed.  
 
Selected area is immediately copied to a buffer - it can be pasted with 
PASTE_TEXT button (default Shift-PgDn) or with mouse btn2 click. Copy 
buffer is implemented as a file called .tn5250sel in user's home 
directory. It is shared by all users tn5250 sessions - data copied from 
one session can be pasted to another session. 
 
Copied data is pasted at current cursor position. Pasting is done the 
way Client Access does it - characters fitting into editable fields are 
pasted, characters falling outside of editable fields are ignored/lost. 
 
When pasting with mouse btn2 click the selection is cleared (reverse 
attribute for selected region is cleared). Another way to clear the 
selection without pasting is to click with mouse btn3 or use COPY_TEXT 
button (see below). 
 
4. Selecting, copying and pasting of rectangular region with keyboard 
 
To select a region with keyboard you have to press Meta key and use 
cursor keys.  If there's a visible selection (may be created with mouse 
drag or key presses), it is 'stretched' according to pressed keys. If 
there's no selection visible, a new selection is created at current 
cursor position and is 'stretched'. When 'stretching' selection area is 
reversed, cursor position is not changed. 
 
Selected area is immediately copied to a buffer - you never know which 
keypress is the last one - and it can be pasted with PASTE_TEXT button 
(default Shift-PgDn) or with mouse btn2 click. 
 
For users loving Windows-style copying there is a COPY_TEXT button 
(default Ctrl-Insert) which actually does nothing with copying 
(selection is already copied), but it clears selection (reverse 
attribute for selected region is cleared). 
 
Data copied with a mouse drag may be pasted with PASTE_TEXT button and 
vice versa - data copied with Meta+cursor keys may be pasted with mouse 
btn2. 
 
REMARKS and TODOS   
 
1. Mouse events should be received via ncurses functions, it would allow 
not only xterm but also gpm as mouse event provider (at least docs say 
so :) ) 
 
2. Using copybuffer in a file does not allow copying and pasting to / 
from other applications, but there is no clipboard notion in curses (or 
I don't know about it), and tn5250 is not an X-window app, so using X 
clipboard seams not a good idea - what if we run it in text mode? 
 
3. I don't use tn5250 in text mode (console), so I don't know much about 
console key mappings. Could someone please add copy, paste and selection 
keys to keymaps? 
 
4. I'm using J.D.Edwards software, which generally uses only text fields 
and handles string to decimal conversion internally. I haven't 
tested my paste algorithm with non-text fields, though I know they exist 
:). Please let me know if it works. 
 
5. When selecting a region, all selected characters but the cursor are 
reversed. I don't like it, maybe we should 'double reverse' the 
character at cursor position to get a nice looking rectangle? 
 
6. I used Ctrl-Insert and Shift-PgDn for COPY_TEXT and PASTE_TEXT keys 
because that's Client Access' default setting. If you have a better idea 
feel free to change it. I will set it for my users to Ctrl-C / Ctrl-V 
anyway. 
 
7. In my patch there is a change to the way characters with VERTICAL 
attribute are displayed. In my opinion changing VERTICAL for UNDERLINE 
is misleading, because underline suggest editable field, and there are 
fields with VERTICAL attribute which aren't editable. Who's contra? :) 
 
That's it for now. Apply the patch, test it and give some feedback. 
 
Best regards 
 
 
Marek Bajon 
 

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].