writing limited character messages like facebook, tweets, etc.

0 views
Skip to first unread message

Larry

unread,
Mar 30, 2012, 7:11:49 PM3/30/12
to GoogleSemWare TSE, tse...@freelists.org
/*** jigcc.s

If you write facebook wall messages or tweets or other messages that
limit text to a number of characters, you might write them in TSE with
the wordwrap turned off giving you a long line up to the character
limit.

This macro might help keep you informed about how many characters you
have in the line and do so as you type, putting the character count
conveniently near the cursor.

Because the lines could be beyond the edge of the window, the macro
keeps the character count inside the window near the cursor.

The character count IS the line length, so it responds to backspacing,
deletions, and block insertions/deletions.

***/

// jigcc.s - character counter as you type

<ctrlalt x> execmacro("jigcc")

proc main()

integer n=0
integer x=0
integer y=0
integer k=0

sound(1000,30)
pushkey(<home>)

loop
k=getkey()

case k

when <ctrlalt x>,<alt pause>
sound(30,30)
goto ending

otherwise
presskey(k)
updatedisplay(_window_refresh_)
if k in 32..255
n=n+1
endif
if n<>currlinelen()
n=currlinelen()
endif
x=wherex()
if currcol()-currxoffset()>query(windowcols)-2*length(str(n))
x=query(windowcols)-2*length(str(n))
endif
if currrow()>query(windowrows)-1
y=wherey()-1
else
y=wherey()+1
endif

putstrxy(x,y,str(n),query(hiliteattr))
sound(11000,1)

endcase
y=query(windowrows)-5
if wherey()>query(windowrows)/2
y=query(windowy1)+5
endif
putstrxy(query(windowcols)-15,y-1,format("jigcc":-15:" "),159)
putstrxy(query(windowcols)-15,y,"CtrlAlt x: Exit",159)

endloop

goto ending
ending:

sound(9000,90)
updatedisplay(_all_windows_refresh_)

end

jigcc.s
Reply all
Reply to author
Forward
0 new messages