Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Determines whether a string is selected
#1
Hi,

I want to use function _s.getsel to determine if a string is currently selected,

But many editor controls, there will also be string lengths without selecting a string, see the demo below

Is there a better way to judge? 

test software url: https://github.com/zufuliu/notepad2/releases

Thanks in advance for any advice and help
david
#2
Many editors copy entire line if there is no selection. Some have an option to turn off it.
Then the text usually ends with newline character. If I don't need entire lines:

Macro Macro3237
Code:
Copy      Help
_s.getsel
out _s.len
if(_s.len=0) ret
if(_s[_s.len-1]=10) mes "please select a word, not entire line"; ret
out _s

Else don't know.
#3
Thanks for the reminder, useful


Forum Jump:


Users browsing this thread: 1 Guest(s)