I made a followup that found that problem. Basically its userkey display of on (1) that will add to the terminal the userkey command and move your cursor to the end, IF your cursor was on the end of the last line, or all of the last line is selected.
----- Original Message ----- From: Henry Rich <[email protected]> To: [email protected] Cc: Sent: Friday, July 24, 2015 7:12 PM Subject: Re: [Jbeta] finddissectline_dissect_, WinSelect_jqtide_ 'sm get term; ' I have checked in a new dissect with this problem fixed. I basically followed your code. I think you are right that wd 'sm get term' returns an incorrect selection value when the cursor is at the end of the last line. Interestingly, WinSelect_jqtide_ seems to have the correct value. I will look into this. Henry Rich On 7/24/2015 12:02 PM, 'Pascal Jasmin' via Beta wrote: > coclass 'jpp' > lr_z_ =: 3 : '5!:5 < ''y''' > pD_z_ =: 1!:2&2 > findline =: 3 : 0 > NB. ft =. WinText_jqtide_ > NB. fs =. WinSelect_jqtide_ > 'ft fs' =. {:"1 wd 'sm get term;' > fs =. 0 ". fs > ft =. 7 u: ft ,LF > NB. If a single value is selected, take the whole line; otherwise the > selected region > if. 1 < # ~. fs do. > 8 u: (-~/\ fs) (];.0~ ,.)~ ft > else. > pD fs =. <: {.fs > pD _50 {. ft > 8 u: (LF taketo&.|. fs {. ft) , LF taketo fs }. ft > end. > ) > execM =: 3 : 0 > > pD@:lr y > ". y > > ) > my userkey entry > > F12;1;Macro exec;execM_jpp_@findline_jpp_ 0 > > This mostly solves everything except for one exception that is perhaps a bug > in sm get term > > if you type or paste say (such that it is at the end of the term) > > 4 + 4 > > and move the cursor one character over, it works fine when F12 pressed. > > > If you leave cursor at the end, the selected text will parse as empty. > Either appending LF to term text, or setting select index to 1 (done above > with <:) less does not change this result. > > another error occurs if the last line is selected. > > debug console prints are left in to show that the term text includes the full > last line when the cursor is moved, but does not include the last line when > cursor is not moved from end, or last line selected. > > ----- Original Message ----- > From: 'Pascal Jasmin' via Beta <[email protected]> > To: "[email protected]" <[email protected]> > Cc: > Sent: Friday, July 24, 2015 10:35 AM > Subject: Re: [Jbeta] finddissectline_dissect_, WinSelect_jqtide_ 'sm get > term; ' > > a fix I think, > > (0 ". fs), # 7 u: ft [ 'ft fs' =. {:"1 wd 'sm get term;' > 94727 94727 94767 > > > if you rerun the line by bringing up the last line ctrl-shift up, so cursor > is at the end > > (0 ". fs), # 7 u: ft [ 'ft fs' =. {:"1 wd 'sm get term;' > 94897 94897 94897 > > it seems like once they get synched they stay synched. I'm unsure how I got > the first result to be 40 off the total... possibly had the cursor early in > the line. > > On another note, J has had ctrl-E for a long time. Would defining selection > as the current line if 0 items selected make sense to everyone else, and then > a > > > 'sm get termselected;' would return selected or line. Though I guess we can > get it to work properly with unicode. > > > > ----- Original Message ----- > From: Henry Rich <[email protected]> > To: [email protected] > Cc: > Sent: Friday, July 24, 2015 8:09 AM > Subject: Re: [Jbeta] finddissectline_dissect_, WinSelect_jqtide_ 'sm get > term; ' > > The problem appears to be caused by display of UTF-8, such as boxes. > Here is a display from a fresh session; on each line the cursor was at > the end of the line when ENTER was pressed, so that select should be the > same as the length of the term window: > > The 3 numbers are (start of selection),(end of selection),(length of > term window text) > > (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' > 54 54 54 > (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' > 118 118 118 > (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' > 185 185 185 > <1 > ┌─┐ > │1│ > └─┘ > (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' > 270 270 286 > > select has fallen 16 characters behind. 16 is exactly the number of > extra bytes added in converting the 8 boxing characters to UTF-8. > > Henry Rich > > On 7/24/2015 12:29 AM, 'Pascal Jasmin' via Beta wrote: >> from >> finddissectline_dissect_ >> >> there appears to be some magic with >> >> WinSelect_jqtide_ >> WinText_jqtide_ >> >> but accessing these seem to get stale quickly. ie. doesn't grow despite >> more getting added to console >> >> this line does update a new "winselect" but it seems out of sync >> >> (400 (i.@[ + -~) 0 {.@". fs) {ft [ 'ft fs' =. {:"1 wd 'sm get term;' >> should print the last 400 characters, but >> >> (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' >> 94123 94123 160296 >> >> (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' >> 94238 94238 160370 >> >> (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' >> 94312 94312 160444 >> (0 ". fs), #ft [ 'ft fs' =. {:"1 wd 'sm get term;' >> 94386 94386 160518 >> >> >> the last select value is well below the character count. These are 4 >> successive calls. Select does not go up by a consistent amount and neither >> does Textcount, though in the last 2 calls there is a consistent 76 increase >> in select and 72 increase in Text >> >> If I were to guess what is happening, for the large discrepancies, is any >> output from 1!:2 does not update fs. >> >> I can point out that finddissectline_dissect_ as a user key breaks fairly >> quickly after starting jqt. Though it does work on startup. >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
