mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 09:13:58 +08:00
Working on correct line wrapping in Fl_Text_Display: starting to replace all byte based charracter calculations with utf8 functions. Current version wraps, but scroll bars are wrong. Non-wrapping text display starts to work better.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7797 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -713,6 +713,7 @@ public:
|
||||
\param ix index to the current char
|
||||
*/
|
||||
int prev_char(int ix) const;
|
||||
int prev_char_clipped(int ix) const;
|
||||
|
||||
/**
|
||||
Returns a pointer to the previous character.
|
||||
@@ -726,6 +727,7 @@ public:
|
||||
\param ix index to the current char
|
||||
*/
|
||||
int next_char(int ix) const;
|
||||
int next_char_clipped(int ix) const;
|
||||
|
||||
/**
|
||||
Returns a pointer to the next character.
|
||||
|
||||
+27
-2
@@ -1585,7 +1585,7 @@ int Fl_Text_Buffer::outputfile(const char *file, int start, int end,
|
||||
Return the previous character position.
|
||||
Uncode safe.
|
||||
*/
|
||||
int Fl_Text_Buffer::prev_char(int pos) const
|
||||
int Fl_Text_Buffer::prev_char_clipped(int pos) const
|
||||
{
|
||||
if (pos<=0)
|
||||
return 0;
|
||||
@@ -1601,9 +1601,21 @@ int Fl_Text_Buffer::prev_char(int pos) const
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the previous character poosition.
|
||||
Returns -1 if the beginning of the buffer is reached.
|
||||
*/
|
||||
int Fl_Text_Buffer::prev_char(int pos) const
|
||||
{
|
||||
if (pos==0) return -1;
|
||||
return prev_char_clipped(pos);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the next character position.
|
||||
Uncode safe.
|
||||
Returns length() if the end of the buffer is reached.
|
||||
*/
|
||||
int Fl_Text_Buffer::next_char(int pos) const
|
||||
{
|
||||
@@ -1614,6 +1626,19 @@ int Fl_Text_Buffer::next_char(int pos) const
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the next character poosition.
|
||||
If the end of the buffer is reached, it returns the current position.
|
||||
*/
|
||||
int Fl_Text_Buffer::next_char_clipped(int pos) const
|
||||
{
|
||||
int n = next_char(pos);
|
||||
if (pos==mLength) return pos;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
||||
+127
-123
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -785,7 +785,7 @@ Fl_Window* new_view() {
|
||||
Fl_Menu_Bar* m = new Fl_Menu_Bar(0, 0, 660, 30);
|
||||
m->copy(menuitems, w);
|
||||
w->editor = new Fl_Text_Editor(0, 30, 660, 370);
|
||||
w->editor->wrap_mode(1, 32);
|
||||
//w->editor->wrap_mode(1, 32);
|
||||
w->editor->textfont(FL_COURIER);
|
||||
w->editor->textsize(TS);
|
||||
w->editor->buffer(textbuf);
|
||||
|
||||
Reference in New Issue
Block a user