--- ./LYForms.c-pre-activemark Thu Jan 18 20:20:42 2001 +++ ./LYForms.c Thu Jan 18 21:40:18 2001 @@ -445,7 +445,7 @@ PRIVATE int form_getstr ARGS3( MyEdit.pos = LastTFPos; #ifdef ENHANCED_LINEEDIT if (MyEdit.pos == 0) - MyEdit.mark = MyEdit.strlen; + MyEdit.mark = -1 - MyEdit.strlen; /* Do not show the region. */ #endif } /* Try to prepare for setting position based on the last mouse event */ --- ./LYStrings.c-pre-activemark Thu Jan 18 21:14:06 2001 +++ ./LYStrings.c Thu Jan 18 22:07:10 2001 @@ -2605,7 +2605,7 @@ PUBLIC void LYSetupEdit ARGS4( Margin = 0; Pos = strlen(old); #ifdef ENHANCED_LINEEDIT - Mark = 0; + Mark = -1; /* pos=0, but do not show it yet */ #endif DspStart = 0; @@ -2744,6 +2744,10 @@ PUBLIC int LYEdit1 ARGS4( #ifdef ENHANCED_LINEEDIT if (Mark > Pos) Mark++; + else if (Mark < -1 - Pos) + Mark--; + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ #endif for(i = length; i >= Pos; i--) /* Make room */ Buf[i+1] = Buf[i]; @@ -2773,6 +2777,10 @@ PUBLIC int LYEdit1 ARGS4( #ifdef ENHANCED_LINEEDIT if (Mark > Pos) Mark++; + else if (Mark < -1 - Pos) + Mark--; + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ #endif for(i = length; i >= Pos; i--) /* Make room */ Buf[i+1] = Buf[i]; @@ -2857,7 +2865,7 @@ PUBLIC int LYEdit1 ARGS4( */ Buf[0] = '\0'; #ifdef ENHANCED_LINEEDIT - Mark = 0; + Mark = -1; /* Do not show the mark */ #endif /* fall through */ @@ -2946,8 +2954,10 @@ PUBLIC int LYEdit1 ARGS4( if (length == 0 || Pos == 0) break; #ifdef ENHANCED_LINEEDIT - if (Mark >= Pos) - Mark--; + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ + if (Mark <= -1 - Pos) + Mark++; #endif Pos--; for (i = Pos; i < length; i++) @@ -2968,6 +2978,12 @@ PUBLIC int LYEdit1 ARGS4( for (i = Pos; i < length; i++) Buf[i] = Buf[i + offset]; i -= offset; +#ifdef ENHANCED_LINEEDIT + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ + if (Mark <= -1 - Pos) + Mark += offset; +#endif } #endif /* SUPPORT_MULTIBYTE_EDIT */ Buf[i] = 0; @@ -3021,8 +3037,12 @@ PUBLIC int LYEdit1 ARGS4( return(ch); if (Pos == length) Pos--; + if (Mark < 0) + Mark = -1 - Mark; /* Temporary enable it */ if (Mark == Pos || Mark == Pos+1) Mark = Pos-1; + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ if (Buf[Pos-1] == Buf[Pos]) { Pos++; break; @@ -3041,6 +3061,8 @@ PUBLIC int LYEdit1 ARGS4( /* * emacs-like exchange-point-and-mark */ + if (Mark < 0) + Mark = -1 - Mark; /* Enable it */ if (Mark == Pos) return(0); i = Pos; Pos = Mark; Mark = i; @@ -3050,6 +3072,8 @@ PUBLIC int LYEdit1 ARGS4( /* * primitive emacs-like kill-region */ + if (Mark < 0) + Mark = -1 - Mark; /* Enable it */ if (Mark == Pos) { killbuffer[0] = '\0'; return(0); @@ -3066,6 +3090,8 @@ PUBLIC int LYEdit1 ARGS4( Buf[i] = Buf[i+reglen]; /* terminate */ Pos = Mark; } + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ break; case LYE_YANK: @@ -3073,14 +3099,14 @@ PUBLIC int LYEdit1 ARGS4( * primitive emacs-like yank */ if (!killbuffer[0]) { - Mark = Pos; + Mark = -1 - Pos; return(0); } { int yanklen = strlen(killbuffer); if (Pos+yanklen <= (MaxLen) && StrLen+yanklen <= (MaxLen)) { - Mark = Pos; + Mark = -1 - Pos; for(i = length; i >= Pos; i--) /* Make room */ Buf[i+yanklen] = Buf[i]; @@ -3305,16 +3331,16 @@ PUBLIC void LYRefreshEdit ARGS1( addch('*'); } else { #ifdef ENHANCED_LINEEDIT - if (DspStart > Mark) + if (Mark >= 0 && DspStart > Mark) TmpStyleOn(prompting ? s_prompt_sel : s_aedit_sel); #endif for (i = 0; i < nrdisplayed; i++) { #ifdef ENHANCED_LINEEDIT - if ( (DspStart + i == Mark && Pos > Mark) - || (DspStart + i == Pos && Pos < Mark) ) + if ( Mark >= 0 && ((DspStart + i == Mark && Pos > Mark) + || (DspStart + i == Pos && Pos < Mark) )) TmpStyleOn(prompting ? s_prompt_sel : s_aedit_sel); - if ( (DspStart + i == Mark && Pos < Mark) - || (DspStart + i == Pos && Pos > Mark) ) + if ( Mark >= 0 && ((DspStart + i == Mark && Pos < Mark) + || (DspStart + i == Pos && Pos > Mark) )) TmpStyleOff(prompting ? s_prompt_sel : s_aedit_sel); #endif if ((buffer[0] = str[i]) == 1 || buffer[0] == 2 || @@ -3351,8 +3377,10 @@ PUBLIC void LYRefreshEdit ARGS1( } } #ifdef ENHANCED_LINEEDIT - if ((DspStart + nrdisplayed <= Mark && DspStart + nrdisplayed > Pos) - || (DspStart + nrdisplayed > Mark && DspStart + nrdisplayed <= Pos)) + if (Mark >= 0 && + ((DspStart + nrdisplayed <= Mark && DspStart + nrdisplayed > Pos) + || (DspStart + nrdisplayed > Mark + && DspStart + nrdisplayed <= Pos))) TmpStyleOff(prompting ? s_prompt_sel : s_aedit_sel); #endif } --- ./LYStrings.h-pre-activemark Sun Oct 15 21:40:58 2000 +++ ./LYStrings.h Thu Jan 18 21:39:50 2001 @@ -195,7 +195,8 @@ typedef struct _EditFieldData { int margin; /* Number of columns look-ahead/look-back */ int current_modifiers; /* Modifiers for next input lynxkeycode */ #ifdef ENHANCED_LINEEDIT - int mark; /* position of emacs-like mark */ + int mark; /* position of emacs-like mark, or -1-pos to denote + unactive mark. */ #endif char buffer[1024]; /* String buffer */