Feature #561
RichTextView should support LeftTriple function when user want to mark whole paragraph fast.
Status: | Rejected | Start date: | 11/02/2013 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Zbigniew Rebacz | % Done: | 100% | |
Category: | CtrlLib | Spent time: | - | |
Target version: | - |
Description
Personally, I think it would be usful if user will be able to mark whole paragraph fast in RichTextView. Below is the implementation of "LeftTriple" method:
void RichTextView::LeftTriple(Point p, dword keyflags) { const int pos = GetPointPos(p); const int paralen = text.GetRichPos(pos).paralen; int len = 0; cursor = pos; while(cursor + 1 < text.GetLength() && text[cursor] != '\n') { cursor++; len++; } anchor = pos; while(anchor > 0 && len != paralen) { anchor--; len++; } RefreshSel(); SetFocus(); }
I enclose tow improved source files.
History
#1 Updated by Zbigniew Rebacz over 11 years ago
- File deleted (
RichTextView.cpp)
#2 Updated by Zbigniew Rebacz over 11 years ago
- File RichTextView.cpp added
#3 Updated by Miroslav Fidler over 11 years ago
Implemented, however I have used more straighforward code (copied from RichEdit...)
#4 Updated by Zbigniew Rebacz over 11 years ago
- File deleted (
RichText.h)
#5 Updated by Zbigniew Rebacz over 11 years ago
- File deleted (
RichTextView.cpp)
#6 Updated by Zbigniew Rebacz over 11 years ago
- File RichTextView.cpp added
Hello Mirek,
In my opinion we shouldn't add one to cursor, because it contributes to selecting empty space.The code should look like this:
void RichTextView::LeftTriple(Point p, dword keyflags) { int pos = GetPointPos(p); RichPos rp = text.GetRichPos(pos); anchor = pos - rp.posinpara; cursor = anchor + rp.paralen; RefreshSel(); SetFocus(); }
#7 Updated by Zbigniew Rebacz over 11 years ago
- Assignee changed from Zbigniew Rebacz to Miroslav Fidler
#8 Updated by Zbigniew Rebacz over 11 years ago
I would like to recommend this little change also for RichTextEditor.
#9 Updated by Zbigniew Rebacz over 11 years ago
Although, previous solution can be more useful for RichTextEditor (I am not sure about this). I am certain sure, that marking text without empty area is more natural for RichTextView.
At the end, I would like to tell that I understand that you don't want the differences between RichTextView and RichTextEdit in behaviour. However, keep in mind that what is useful for viewing document is not necessarily good for editing document. Ultimate++ as a complex library should take into account such nuances.
#10 Updated by Zbigniew Rebacz over 11 years ago
I have made some research on Windows (Windows 8) and it seems that my solution is 100% compatibility with M$ (This behavior can be seen in M$ help windows).
#11 Updated by Zbigniew Rebacz over 11 years ago
Implementation for RichEdit (RichEdit/Mouse.cpp - line 349):
void RichEdit::LeftTriple(Point p, dword flags) { NextUndo(); int c = GetMousePos(p); if(c >= 0 && c != objectpos) { RichPos rp = text.GetRichPos(c); Select(c - rp.posinpara, rp.paralen); } }
#12 Updated by Zbigniew Rebacz over 11 years ago
- File deleted (
RichTextView.cpp)
#13 Updated by Miroslav Fidler over 11 years ago
- Status changed from Ready for QA to Rejected
- Assignee changed from Miroslav Fidler to Zbigniew Rebacz
Zbigniew Rebacz wrote:
Hello Mirek,
In my opinion we shouldn't add one to cursor, because it contributes to selecting empty space.The code should look like this:
Well, it is interesting. IMO closest equivalent to RichTextView in this regard is web browser. Here:
Internet Explorer and Chrome seem to select WITH the terminal "paragraph ending character".
Firefox seems to select WITHOUT.
So it is quite obviously a matter of opinion. IMO, it is better to include it.
Mirek