AmendHub

jcs

/

textview

/

amendments

Amendments on November 21, 2024

TVFindInRect: Make this public, allow tags with styles

Adding a tag to a style allows a chunk of text to be found later by
the caller by giving it a unique tag in its style.
jcs made amendment 55 over 2 years ago

Amendments on November 15, 2024

TVUpdate: Revert EraseRect change, we should not be erasing on update

It's up to the caller to clear the area if it drew over us
jcs made amendment 54 over 2 years ago

Amendments on November 14, 2024

TVCalcLinesLocked+TVDrawMatch: Fix tabstop calculation

Turn tabstop into a number of pixels per tabstop rather than a number
of characters. This makes it behave more like a word processor that
will align characters of different fonts and sizes on a particular
vertical boundary, rather than indenting a number of spaces.
 
Also make TVDrawMatch bail early when drawing lines that are further
down than our viewport will show.
jcs made amendment 53 over 2 years ago

Amendments on November 13, 2024

TVUpdate: EraseRect before redrawing, avoid a div-by-zero

The caller may have erased its window and filled the window with a
background pattern, so we have to erase our working area first.
jcs made amendment 52 over 2 years ago

TVAppendBitMap: Require a TVStyle passed with sizing information

This allows the caller to specify where on the baseline the bitmap
is drawn, and allows it to add spacing after it by setting
font_info.widMax.
 
Also handle lines with multiple styles growing the leading size.
jcs made amendment 50 over 2 years ago

Amendments on November 12, 2024

TVNew: Erase initial view port when created

jcs made amendment 49 over 2 years ago

*: Add support for inline images!

Move styles to be stored in a slab just like the others so it can
grow as needed and allow BitMap data to be stored there.
 
Fix redrawing of lines when they have to grow due to larger text
added on the same line, now that we're not using the canvas.
jcs made amendment 48 over 2 years ago

Amendments on November 8, 2024

TVFindInRect: When we don't get a start hint, make an educated guess

This greatly speeds up scrolling
 
Also move everything to longs, on a huge text we were hitting the
max short size and wrapping around
jcs made amendment 47 over 2 years ago

TVTrackScrollControl: Use TVFindInRect

Now with everything using TVFindInRect, we just need to speed up
that one function...
jcs made amendment 46 over 2 years ago

*: Stop using the canvas, it's slowing us down

It looks smoother but slower, so if we just speed things up we won't
need it
jcs made amendment 45 over 2 years ago

TVAppendLine: Add, reduce unnecessary redrawing in TVUpdateScrollbar

A common pattern is to TVAppend a line from a buffer but then have
to insert manual \r line breaks to skip over \n breaks in a buffer.
To avoid having to TVAppend(line) and TVAppend('\r'), move TVAppend
to TVAppendLocked and take a terminating character, and make
TVAppend pass 0.
 
Now a caller can just do TVAppendLine in a single call and not have
to waste time with all the setup and recalculation in TVAppend just
to append one linebreak.
 
Also do checking in TVUpdateScrollbar to ignore redrawing if the
scroll "elevator" won't be moving, such as when it's pegged to the
top or bottom.
jcs made amendment 44 over 2 years ago

Amendments on November 4, 2024

TVGetText: Fix slab iteration

jcs made amendment 43 over 2 years ago

Amendments on October 29, 2024

TVGetText: Add function to read all text slabs into a single buffer

Since users can't access the text directly like a TextEdit control,
provide this so all of the text can be copied somewhere.
jcs made amendment 42 over 2 years ago

TVGetOffset: Return a long to be able to return -1, fix TVClear

We weren't clearing first_chunk and last_chunk when clearing so the
next drawing might have gone into lala land.
 
Also use an initial slab id of 1 to avoid the not-0-offset hackery.
jcs made amendment 41 over 2 years ago

Amendments on October 25, 2024

Allow turning off re-calculation in TVAppend, add stubs for select/copy

For applications doing lots of small appends, it may be useful to
just do one TVCalcLines after adding a chunk of data
jcs made amendment 38 over 2 years ago

If our total bounds length is more than SHRT_MAX, divide it down

The scrollbar control can only take a max of SHRT_MAX, so if we need
to deal with more lines than that, calculate divided down by 10
jcs made amendment 37 over 2 years ago

Add toggle for line wrapping and a configurable tab stop

When tab stop is non-zero, tab characters are rendered as spaces to
that tab stop which only really makes sense right now for fixed-width
fonts
jcs made amendment 36 over 2 years ago