Bytes selected

jlcox

Member³
Enhancement request...when selecting a block of text in the editor, show the number of selected bytes (or characters) in the editor bottom gutter, maybe near the text which displays current cursor line and column position.

Use case: I have a string constant declared in a package as a varchar2, and want to change the text. I need to know the size of the string to resize the varchar2 declaration, if necessary. Currently, I copy the string, paste it into TextPad and select the text to get the size. (TextPad does exactly what I'm asking here). Would be much easier if I could see it directly in the editor.
 
I had written a plugin for that, its called Scale.

I have a more generic version, using AutoHotKey, that doesn't have a ruler, but it tells you the number of lines and total character count.

Put the following into your AutoHotkey.ahk, reload it, select some text and then press Win-l

Code:
;------------------------------------
; Selected Length, Win-l
;------------------------------------
#l:: ; report the length of selected text

  ; save the contents of the clipboare
  clipboard_save = %clipboardall% ; save text and non-text contents of clipboard
  clipboard := ; clear out the clipboard

  ; get the selected text into the clipboard
  send, ^c
  clipwait, 5 ; wait for clipboard contents to change, wait at most 5 seconds

  ; save the text to measure
  clip_text = %clipboard%

  ; restore the clipboard contents
  clipboard = %clipboard_save%

  ; determine the length of the text
  stringlen, text_len, clip_text

  ; split the clipboard contents into lines
  line_cnt := 0
  loop, parse, clip_text, `n
  {
    line_cnt := line_cnt + 1
  }

  ; let the user know how long
  msgbox, lines - %line_cnt%`ncharacters - %text_len%`n`nSelected text `n===========`n "%clip_text%" `n===========`n

return
{/code]
 
Roeland,
You are welcome.

jlcox,
I am trying to get away from program specific versions of common actions - if I need the functionality in more than one place I write it in AutoHotKey and have it everywhere.
 
Back
Top