three patches from Dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@870 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-07-10 10:31:34 +00:00
parent 38d06c587e
commit 146b245e5c
4 changed files with 58 additions and 32 deletions

View File

@ -1,3 +1,23 @@
2000-07-08 Dekel Tsur <dekel@math.tau.ac.il>
* src/text.C (GetColumnNearX): Better behavior when a RTL
paragraph is ended by LTR text.
* src/text2.C (SetCurrentFont,CursorLeftIntern,CursorRightIntern):
Ditto
2000-07-08 Dekel Tsur <dekel@math.tau.ac.il>
* src/WorkArea.C (request_clipboard_cb): Set clipboard_read to
true when clipboard is empty.
2000-07-08 Dekel Tsur <dekel@math.tau.ac.il>
* text.C (Backspace): Prevent rebreaking of a row if it is the last
row of the paragraph.
(SetHeightOfRow): Call to PrepareToPrint with 7th argument = false
to prevent calculation of bidi tables
2000-07-07 Juergen Vigna <jug@sad.it>
* src/screen.C (ToggleSelection): added y_offset and x_offset

View File

@ -384,12 +384,11 @@ int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
void const * data, long size)
{
clipboard_selection.erase();
if (size == 0) return 0; // no selection
clipboard_selection.reserve(size);
for (int i = 0; i < size; ++i) {
if (size > 0)
clipboard_selection.reserve(size);
for (int i = 0; i < size; ++i)
clipboard_selection += static_cast<char const *>(data)[i];
}
clipboard_read = true;
return 0;
}

View File

@ -1647,7 +1647,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
height += row_ptr->height();
float x, dummy;
PrepareToPrint(bview, row_ptr, x, dummy, dummy, dummy);
PrepareToPrint(bview, row_ptr, x, dummy, dummy, dummy, false);
row_ptr->width(maxwidth+x);
if (inset_owner) {
Row * r = firstrow;
@ -3688,18 +3688,15 @@ void LyXText::Backspace(BufferView * bview)
}
// break the cursor row again
z = NextBreakPoint(bview, row, workWidth(bview));
if (z != RowLast(row) ||
(row->next() && row->next()->par() == row->par() &&
RowLast(row) == row->par()->Last() - 1)){
if (row->next() && row->next()->par() == row->par() &&
(RowLast(row) == row->par()->Last() - 1 ||
NextBreakPoint(bview, row, workWidth(bview)) != RowLast(row))) {
/* it can happen that a paragraph loses one row
* without a real breakup. This is when a word
* is to long to be broken. Well, I don t care this
* hack ;-) */
if (row->next() && row->next()->par() == row->par() &&
RowLast(row) == row->par()->Last() - 1)
if (RowLast(row) == row->par()->Last() - 1)
RemoveRow(row->next());
refresh_y = y;
@ -3710,10 +3707,7 @@ void LyXText::Backspace(BufferView * bview)
SetCursor(bview, cursor.par(), cursor.pos(), false, cursor.boundary());
// cursor MUST be in row now
if (row->next() && row->next()->par() == row->par())
need_break_row = row->next();
else
need_break_row = 0;
need_break_row = row->next();
} else {
// set the dimensions of the row
row->fill(Fill(bview, row, workWidth(bview)));
@ -3734,9 +3728,9 @@ void LyXText::Backspace(BufferView * bview)
lastpos = cursor.par()->Last();
if (cursor.pos() == lastpos) {
SetCurrentFont(bview);
if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) != cursor.boundary())
SetCursor(bview, cursor.par(), cursor.pos(), false, !cursor.boundary());
SetCurrentFont(bview);
}
// check, wether the last characters font has changed.
@ -4764,14 +4758,21 @@ int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x,
}
#endif
if (vc > last + 1) // This shouldn't happen.
vc = last + 1;
boundary = false;
bool lastrow = (!row->next() || row->next()->par() != row->par());
bool rtl = (lastrow)
? row->par()->isRightToLeftPar(bview->buffer()->params)
: false;
if (row->pos() > last) // Row is empty?
c = row->pos();
else if (lastrow &&
( (rtl && vc == row->pos()&& x < tmpx - 5) ||
(!rtl && vc == last + 1 && x > tmpx + 5) ))
c = last + 1;
else if (vc == row->pos() ||
(row->par()->table
&& vc <= last && row->par()->IsNewline(vc-1)) ) {

View File

@ -40,6 +40,7 @@
#include "Painter.h"
#include "font.h"
#include "debug.h"
#include "lyxrc.h"
//#define USE_OLD_CUT_AND_PASTE 1
@ -2867,6 +2868,15 @@ void LyXText::SetCurrentFont(BufferView * bview) const
current_font =
cursor.par()->GetFontSettings(bview->buffer()->params, pos);
real_current_font = GetFont(bview->buffer(), cursor.par(), pos);
if (cursor.pos() == cursor.par()->Last() &&
IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) &&
!cursor.boundary()) {
Language const * lang =
cursor.par()->getParLanguage(bview->buffer()->params);
current_font.setLanguage(lang);
real_current_font.setLanguage(lang);
}
}
@ -2934,10 +2944,7 @@ void LyXText::CursorLeftIntern(BufferView * bview, bool internal) const
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, true);
} else if (cursor.par()->Previous()) { // steps into the above paragraph.
LyXParagraph * par = cursor.par()->Previous();
LyXParagraph::size_type pos = par->Last();
SetCursor(bview, par, pos);
if (IsBoundary(bview->buffer(), par, pos))
SetCursor(bview, par, pos, false, true);
SetCursor(bview, par, par->Last());
}
}
@ -2959,15 +2966,14 @@ void LyXText::CursorRight(BufferView * bview, bool internal) const
void LyXText::CursorRightIntern(BufferView * bview, bool internal) const
{
if (cursor.pos() < cursor.par()->Last()) {
if (!internal && cursor.boundary() &&
(!cursor.par()->table || !cursor.par()->IsNewline(cursor.pos())))
SetCursor(bview, cursor.par(), cursor.pos(), true, false);
else {
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, false);
if (!internal && IsBoundary(bview->buffer(), cursor.par(), cursor.pos()))
SetCursor(bview, cursor.par(), cursor.pos(), true, true);
}
if (!internal && cursor.boundary() &&
(!cursor.par()->table || !cursor.par()->IsNewline(cursor.pos())))
SetCursor(bview, cursor.par(), cursor.pos(), true, false);
else if (cursor.pos() < cursor.par()->Last()) {
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, false);
if (!internal &&
IsBoundary(bview->buffer(), cursor.par(), cursor.pos()))
SetCursor(bview, cursor.par(), cursor.pos(), true, true);
} else if (cursor.par()->Next())
SetCursor(bview, cursor.par()->Next(), 0);
}