Skip to content

Commit 4ba7dd2

Browse files
Window: Major crash fix. (#1021)
A patch handling focus was recently merged, but a special condition on Windows was inverted, causing a segfault. Bug:#1020
1 parent ee24bec commit 4ba7dd2

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
--gcov-executable '${{ matrix.gcov_executable }}';
105105
106106
- name: Windows - Test and coverage
107-
if: runner.os == 'Windows' && false
107+
if: runner.os == 'Windows'
108108
working-directory: ./build
109109
run: >
110110
OpenCppCoverage.exe

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
Unreleased
5+
-----
6+
7+
### Component
8+
- BugFix: Fix major crash on Windows affecting all components. See #1020
9+
- BugFix: Fix focusRelative.
10+
411
6.0.1 (2025-03-28)
512
-----
613

src/ftxui/dom/focus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Decorator focusPositionRelative(float x, float y) {
3636

3737
void ComputeRequirement() override {
3838
NodeDecorator::ComputeRequirement();
39-
requirement_.focused.enabled = false;
39+
requirement_.focused.enabled = true;
4040
requirement_.focused.node = this;
4141
requirement_.focused.box.x_min = int(float(requirement_.min_x) * x_);
4242
requirement_.focused.box.y_min = int(float(requirement_.min_y) * y_);

src/ftxui/dom/node.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,27 +125,27 @@ void Render(Screen& screen, Node* node, Selection& selection) {
125125
node->Select(selection);
126126
}
127127

128-
// Setting the cursor to the right position allow folks using CJK (China,
129-
// Japanese, Korean, ...) characters to see their [input method editor]
130-
// displayed at the right location. See [issue].
131-
//
132-
// [input method editor]:
133-
// https://en.wikipedia.org/wiki/Input_method
134-
//
135-
// [issue]:
136-
// https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
137-
//
138-
// Unfortunately, Microsoft terminal do not handle properly hiding the
139-
// cursor. Instead the character under the cursor is hidden, which is a big
140-
// problem. As a result, we can't enable setting cursor to the right
141-
// location. It will be displayed at the bottom right corner.
142-
// See:
143-
// https://github.com/microsoft/terminal/issues/1203
144-
// https://github.com/microsoft/terminal/issues/3093
145128
if (node->requirement().focused.enabled
146129
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
147-
||
148-
node->requirement().focused.cursor_shape == Screen::Cursor::Shape::Hidden
130+
// Setting the cursor to the right position allow folks using CJK (China,
131+
// Japanese, Korean, ...) characters to see their [input method editor]
132+
// displayed at the right location. See [issue].
133+
//
134+
// [input method editor]:
135+
// https://en.wikipedia.org/wiki/Input_method
136+
//
137+
// [issue]:
138+
// https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
139+
//
140+
// Unfortunately, Microsoft terminal do not handle properly hiding the
141+
// cursor. Instead the character under the cursor is hidden, which is a
142+
// big problem. As a result, we can't enable setting cursor to the right
143+
// location. It will be displayed at the bottom right corner.
144+
// See:
145+
// https://github.com/microsoft/terminal/issues/1203
146+
// https://github.com/microsoft/terminal/issues/3093
147+
&&
148+
!node->requirement().focused.cursor_shape == Screen::Cursor::Shape::Hidden
149149
#endif
150150
) {
151151
screen.SetCursor(Screen::Cursor{

0 commit comments

Comments
 (0)