Commit Graph

25 Commits

Author SHA1 Message Date
Albrecht Schlosser 05a95e146b Fix Fl_Terminal::handle_unknown_char() for plot_char() (#948)
- Add 'int Fl_Terminal::handle_unknown_char(int drow, int dcol)'
  to write the "unknown" character to the intended display position.

- Define Fl_Terminal::unknown_char as a static variable to avoid
  redundancy. In the future this might be overridden by users.
2024-04-09 12:53:12 +02:00
Greg Ercolano 31170c4731 Rename putchar() to plot_char() (#944)
Some old platforms (NetBSD, AIX) implement the common stdio "putchar()"
function as a global macro which poisons the global namespace, preventing
all C and C++ programs from using "putchar()" as a function or method.

There was a long thread about this in fltk.coredev during the period
Mar 25 2024 ~ Apr 4 2024, subject "RFC: Fl_Terminal::putchar() in public API"
as to why we have no choice but to not use putchar() as a method name.
2024-04-06 23:36:04 -07:00
Greg Ercolano 13526f04ab Make Fl_Terminal selection_text() methods public
As per Albrecht's request on fltk.coredev..
2024-03-12 13:18:54 -07:00
Albrecht Schlosser 3ac007541e
Add horizontal scrollbar to Terminal widget (#928)
* Checkpoint. Basic functionality seems to be working.

* Code cleanup

* Added horizontal scrollbar to Terminal widget

* Fix hscrollbar_size operation

* Applied erco-terminal-mods_v5_final.patch.txt
Final patch relating to PR 918

* Remove trailing whitespace, update copyright year

---------

Co-authored-by: Jonathan Griffitts <jonathan.griffitts@gmail.com>
Co-authored-by: Greg Ercolano <erco@seriss.com>
Co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
2024-03-06 21:16:11 -08:00
Greg Ercolano 257e20e929 Added Fl_Terminal::text() and docs 2024-03-02 22:47:45 -08:00
Matthias Melcher 2f343ad64d
Fix Terminal character position and add word selection (#906)
* Improve horizontal interactive selection
* Using half-character positions to implement selection
  similar to Fl_Input.
* Add word and line selection
* Fix vertical position of text
2024-02-18 13:29:37 +01:00
Greg Ercolano eb4916344b Clear screen also clears attributes/xterm modes (#911)
Clear was setting characters to a space using the current style,
but if the style left Dim/Bold/Inverse (etc) enabled, that was being
used to affect the clear character, and thus affected clearing screen.

Seems weird tho; what if one wants to do a cleol (\033[K) on a screen
that is all inverted text; is there no way to use inverse mode for
clearing to the end of line? Or to delete a character?
2024-02-17 07:59:42 -08:00
Greg Ercolano 58a1496389 Fixed Fl_Terminal xterm color 39/49 handling, and other mods.
Fixed a bug in the handling of xterm color 39 + 49, which avoids
applying Dim/Bold if default color is the special "see through" color
0xffffff00. A test will be added to test/terminal to excercise this
in a follow up commit.

Renamed CharStyle::?gcolor_uchar() -> CharStyle::?gcolor_xterm()
for a consistent naming convention.

Changed fltk_fg_color() from a static func to a CharStyle method
because it needs to access the defaultcolor for the special cases
for xterm colors 39 and 49.

Made CharStyle::attr_color() private, as per Jonathan Griffitts request
in issue #909.

Improved docs regarding effects of Dim/Bold for xterm and non-xterm color
methods.

Fl_Terminal::text?gcolor_xterm() methods now use CharStyle::?gcolor_xterm()
methods, removing the duplicate code logic.
2024-02-16 13:10:06 -08:00
Greg Ercolano 1069ebc1b6 Fix Fl_Terminal xterm CharStyle charflags (#909) 2024-02-16 04:46:05 -08:00
Greg Ercolano 3142eb2fda Small code fixups
> Enabled -Wall -Wextra -Wpedantic to catch errors
    - Silenced resulting "unused parameters" warnings
    - Fixed char omission in protected Fl_Terminal::insert_char() methods
> Self doc code and better comments in RingBuffer::resize()
> Changed private RingBuffer::clear_disp_row() -> clear_disp_rows()
> Added private RingBuffer::hist_rows()/disp_rows() setter methods
> Added private RingBuffer::offset_adjust() method for adjusting RingBuffer offset_
> Fixed comment typos
> Remove white space inside outer parens of while()/if()/etc
2024-01-15 14:33:17 -08:00
Greg Ercolano 08e64283aa Add textattrib() get method+docs
Requested by Jonathan Griffitts during rust bindings.
2024-01-10 09:10:07 -08:00
Greg Ercolano 38aff7d9b4 solve issue 853: make scrollbar public 2023-11-29 08:29:24 -08:00
Greg Ercolano 0080850092 Fl_Terminal better name for flags -> charflags 2023-11-25 06:56:38 -08:00
Matthias Melcher b6be421a1f Added safety when calling Text_Display methods
- before assigning a buffer (Github #845)
- also fixed a warning form unused arg in Fl_Terminal
2023-11-23 15:16:34 +01:00
Greg Ercolano 9894812644 Make new handle_lf/cr methods private 2023-11-22 06:34:24 -08:00
Greg Ercolano 9383f172a8 Fl_Terminal docs: Added some tables 2023-11-21 14:41:15 -08:00
Greg Ercolano c568056244 Added output_translate(): controls lf -> crlf translation 2023-11-21 11:24:27 -08:00
Greg Ercolano 56e85e8522 Fl_Terminal docs for fg/bg colors 2023-11-21 09:06:46 -08:00
Greg Ercolano 6252131017 Solve issue 837, doc some protected methods. 2023-11-20 09:26:40 -08:00
Greg Ercolano bc8b186398 Doc all pub/prot members, remove unused, add todo
- Made sure all public+protected members are documented.

- Reclassified some private -> protected:
   > vscroll_width()

- Removed signatures for unimplemented (non-existant) methods:
   > u8c_cursor(void)
   > history_use(int,bool)
   > cursor_h()

- Reclassified some protected -> private:
   > x_to_glob_col()
   > xy_to_glob_rowcol()
   > is_hist_ring_row()
   > is_disp_ring_row()
   > handle_ctrl()
   > is_printable()
   > is_ctrl()
   ..etc..
   > handle_selection_autoscroll()
   > handle_selection()
   > is_redraw_style

- Add todo for ESC 7 and ESC 8
- Small code formatting mods
- Small typos
2023-11-19 22:46:04 -08:00
Albrecht Schlosser a72eff7588 Fix compiler warnings in Fl_Terminal on Windows
- missing FL_EXPORT: Visual Studio (dll)
- missing include <stdarg.h>: MinGW
2023-11-19 17:58:57 +01:00
Albrecht Schlosser 367d302b5f Apply two patches provided by user 'Andre' via mail
1. add missing FL_EXPORT to class Fl_Terminal
2. add missing test/wizard demo to test/Makefile
2023-11-17 19:27:00 +01:00
Greg Ercolano 38fc08c15f Added clear(), some methods protected->public
New public methods:

    void clear(void);
    void clear(Fl_Color val);

old protected methods made public:

    void clear_screen(bool scroll_to_hist=true);      // ESC [ 2 J
    void clear_screen_home(bool scroll_to_hist=true); // ESC [ H ESC [ 2 J
    void cursor_home(void);                           // ESC [ 0 H

test/terminal modified to test these, and added separate tests
for both the API and ANSI code ways to do these ops.
2023-11-16 15:45:29 -08:00
Greg Ercolano 605328e045 Added textcolor() and color(), doc fixes.
textcolor() needed for consistency, color() behavior documented.

Both added to the test/terminal app.

Elaborated on the special background "see through" color value + behavior,
tested with color() in test/terminal app.
2023-11-14 12:23:23 -08:00
erco77 6842a43a31
Fl_Terminal widget (#800)
Pull Fl_Terminal widget from Greg's fork
2023-11-14 07:01:52 -08:00