Skip to content

Commit

Permalink
Implement "Copy as RTF" (port code from SciTE), issue #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Jan 19, 2023
1 parent 109bd0e commit b718d0d
Show file tree
Hide file tree
Showing 11 changed files with 382 additions and 1 deletion.
4 changes: 4 additions & 0 deletions scintilla/call/ScintillaCall.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ CharacterSet ScintillaCall::StyleGetCharacterSet(int style) {
return static_cast<Scintilla::CharacterSet>(Call(Message::StyleGetCharacterSet, style));
}

bool ScintillaCall::StyleGetStrike(int style) {
return Call(Message::StyleGetStrike, style);
}

bool ScintillaCall::StyleGetVisible(int style) {
return Call(Message::StyleGetVisible, style);
}
Expand Down
1 change: 1 addition & 0 deletions scintilla/include/Scintilla.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_STYLEGETUNDERLINE 2488
#define SCI_STYLEGETCASE 2489
#define SCI_STYLEGETCHARACTERSET 2490
#define SCI_STYLEGETSTRIKE 2283
#define SCI_STYLEGETVISIBLE 2491
#define SCI_STYLEGETCHANGEABLE 2492
#define SCI_STYLEGETHOTSPOT 2493
Expand Down
3 changes: 3 additions & 0 deletions scintilla/include/Scintilla.iface
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ get CaseVisible StyleGetCase=2489(int style,)
# Get the character get of the font in a style.
get CharacterSet StyleGetCharacterSet=2490(int style,)

# Get is a style strike or not.
get bool StyleGetStrike=2283(int style,)

# Get is a style visible or not.
get bool StyleGetVisible=2491(int style,)

Expand Down
1 change: 1 addition & 0 deletions scintilla/include/ScintillaCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class ScintillaCall {
bool StyleGetUnderline(int style);
Scintilla::CaseVisible StyleGetCase(int style);
Scintilla::CharacterSet StyleGetCharacterSet(int style);
bool StyleGetStrike(int style);
bool StyleGetVisible(int style);
bool StyleGetChangeable(int style);
bool StyleGetHotSpot(int style);
Expand Down
1 change: 1 addition & 0 deletions scintilla/include/ScintillaMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ enum class Message {
StyleGetUnderline = 2488,
StyleGetCase = 2489,
StyleGetCharacterSet = 2490,
StyleGetStrike = 2283,
StyleGetVisible = 2491,
StyleGetChangeable = 2492,
StyleGetHotSpot = 2493,
Expand Down
4 changes: 4 additions & 0 deletions scintilla/src/Editor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ void Editor::VerticalCentreCaret() noexcept {
const Sci::Line newTop = lineDisplay - (LinesOnScreen() / 2);
if (topLine != newTop) {
SetTopLine(newTop > 0 ? newTop : 0);
SetVerticalScrollPos();
RedrawRect(GetClientRectangle());
}
}
Expand Down Expand Up @@ -5971,6 +5972,8 @@ sptr_t Editor::StyleGetMessage(Message iMessage, uptr_t wParam, sptr_t lParam) {
return StringResult(lParam, vs.styles[wParam].fontName);
case Message::StyleGetUnderline:
return vs.styles[wParam].underline ? 1 : 0;
case Message::StyleGetStrike:
return vs.styles[wParam].strike ? 1 : 0;
case Message::StyleGetCase:
return static_cast<sptr_t>(vs.styles[wParam].caseForce);
case Message::StyleGetCharacterSet:
Expand Down Expand Up @@ -7380,6 +7383,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
case Message::StyleGetSizeFractional:
case Message::StyleGetFont:
case Message::StyleGetUnderline:
case Message::StyleGetStrike:
case Message::StyleGetCase:
case Message::StyleGetCharacterSet:
case Message::StyleGetVisible:
Expand Down
2 changes: 1 addition & 1 deletion scintilla/src/SplitVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ constexpr bool InRangeInclusive(size_t index, size_t length) noexcept {
}

constexpr bool InRangeExclusive(size_t index, size_t length) noexcept {
return index <= length;
return index < length;
}

constexpr bool IsValidIndex(size_t index, size_t length) noexcept {
Expand Down
Loading

0 comments on commit b718d0d

Please sign in to comment.