Neil Hodgson wrote:
> Snow:
>>1) Horizontal scrollbar on long lines: I've added some code to the
>>Paint() method
>
> This should not occur inside the paint code as too much is already
> occurring there. The width could be disovered here and then reflected
> in the scroll bar during idle or timer processing.
OK, good point. I've attached a revised patch that adds a field
Editor::currentPageWidth. This is updated in Paint(); and Idle() calls
SetScrollBars() when currentPageWidth != scrollWidth.
>>2) Find is very slow if the codepage isn't UTF8:
>
> The code page should only be set when multi-byte characters are
> possible. That is why the field is called "dbcsCodePage".
It seems that codepages aren't what I thought they were. I'll go away
and look at it some more.
> On GTK+, code pages such as EUC* may use up to 3 bytes per character.
I didn't change anything. The current version assumes 2.
>>3) Rectangular pasting:
>>
>>a) If the clipboard contains a single line and there is a rectangular
>>selection (possibly zero-width), then the clipboard line will be copied
>>onto each of the selected lines.
>
>
> I'm not sure about this. Possibly it could be an option to preserve
> compatibility with other editors.
With hindsight I agree that this is probably going to deviate from many
users' expectations. I will reconsider and either abandon it or resubmit
as optional behaviour.
>>b) If there is a rectangular selection then pasting will be rectangular
>>whether the clipboard content was copied rectangular or not; but only if
>>the number of lines selected matches the number in the clipboard
>>(excepting case (a) above).
>>
>>c) If the clipboard contains a rectangular copy, then pasting is not
>>allowed if there is a stream-selection.
>
>
> b and c appears to me to be decreases in functionality and do not
> match other editors such as Visual Studio.
I agree that VS and many other editors other editors behave like this,
but I assumed it was simply a by-product of the implementation rather
than an intentional feature. The sequence of steps I am considering is:
1) User copies a multi-line stream-selection.
2) User makes a multi-line rectangular-selection.
3) User presses paste.
Are there really users who do this and expect:
1) The first line of the rect-selection to be replace by multiple lines
from the clipboard (making the original line split several lines apart).
2) All except the first rect-select lines are removed.
To me it just seems like an incompatible mix of column and stream based
editing. I only use rect-select when I'm doing grid-like editing, so the
idea of pasting EOLs doesn't make sense to me. Are there users who use
rect-selection for different purposes? What sort of use cases do they have?
--
Snow
diff -r -u scintilla167/src/Editor.cxx scintilla/src/Editor.cxx
--- scintilla167/src/Editor.cxx 2005-12-10 09:22:10.000000000 +0000
+++ scintilla/src/Editor.cxx 2006-03-06 21:56:26.000000000 +0000
@@ -2818,6 +2818,8 @@
rcTextArea.right -= vs.rightMarginWidth;
surfaceWindow->SetClip(rcTextArea);
+ int textAreaWidth = rcTextArea.right - rcTextArea.left - 1;
+ int dispScrollWidth = textAreaWidth;
// Loop on visible lines
//double durLayout = 0.0;
//double durPaint = 0.0;
@@ -2862,6 +2864,9 @@
ll->containsCaret = false;
}
+ int lineLength =
ll->positions[ll->numCharsInLine];
+ dispScrollWidth = lineLength > dispScrollWidth
? lineLength : dispScrollWidth;
+
GetHotSpotRange(ll->hsStart, ll->hsEnd);
PRectangle rcLine = rcClient;
@@ -3004,6 +3009,20 @@
//if (durPaint < 0.00000001)
// durPaint = 0.00000001;
+ // If we are scrolled too far right for this page,
+ // make the scrollbars bigger.
+ if (dispScrollWidth < xOffset + textAreaWidth) {
+ dispScrollWidth = xOffset + textAreaWidth;
+ }
+
+ // If the needed width is bigger increase it, if the needed width is
more than 50
+ // smaller and we have painted the whole screen decrease it.
+ if (dispScrollWidth > scrollWidth ||
+ (scrollWidth - dispScrollWidth > 50 && rcClient.Height() ==
rcArea.Height())) {
+ currentPageWidth = dispScrollWidth;
+ SetIdle(true);
+ }
+
// Right column limit indicator
PRectangle rcBeyondEOF = rcClient;
rcBeyondEOF.left = vs.fixedColumnWidth;
@@ -5387,6 +5406,11 @@
wrappingDone = true;
}
+ if (currentPageWidth != scrollWidth) {
+ scrollWidth = currentPageWidth;
+ SetScrollBars();
+ }
+
// Add more idle things to do here, but make sure idleDone is
// set correctly before the function returns. returning
// false will stop calling this idle funtion until SetIdle() is
diff -r -u scintilla167/src/Editor.h scintilla/src/Editor.h
--- scintilla167/src/Editor.h 2005-12-10 09:22:10.000000000 +0000
+++ scintilla/src/Editor.h 2006-03-06 21:34:16.000000000 +0000
@@ -218,6 +218,7 @@
int xCaretMargin; ///< Ensure this many pixels visible on both
sides of caret
bool horizontalScrollBarVisible;
int scrollWidth;
+ int currentPageWidth;
bool verticalScrollBarVisible;
bool endAtLastLine;
bool caretSticky;
diff -r -u scintilla167/win32/ScintillaWin.cxx scintilla/win32/ScintillaWin.cxx
--- scintilla167/win32/ScintillaWin.cxx 2005-11-30 09:42:42.000000000 +0000
+++ scintilla/win32/ScintillaWin.cxx 2006-03-06 21:47:48.000000000 +0000
@@ -1107,13 +1107,14 @@
if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
horizEndPreferred = 0;
unsigned int pageWidth = rcText.Width();
- sci.fMask = SIF_PAGE | SIF_RANGE;
GetScrollInfo(SB_HORZ, &sci);
if ((sci.nMin != 0) ||
(sci.nMax != horizEndPreferred) ||
(sci.nPage != pageWidth) ||
(sci.nPos != 0)) {
sci.fMask = SIF_PAGE | SIF_RANGE;
+ if (horizEndPreferred != 0)
+ sci.fMask |= SIF_DISABLENOSCROLL;
sci.nMin = 0;
sci.nMax = horizEndPreferred;
sci.nPage = pageWidth;
@@ -1123,6 +1124,11 @@
modified = true;
if (scrollWidth < static_cast<int>(pageWidth)) {
HorizontalScrollTo(0);
+ } else if (horizEndPreferred != 0) {
+ // Sometime Windows won't display the horizontal
scrollbar
+ // This seems to persuade it most of the time.
+ ShowScrollBar(MainHWND(), SB_HORZ, FALSE);
+ ShowScrollBar(MainHWND(), SB_HORZ, TRUE);
}
}
return modified;
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest