mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Window: Major crash fix. (#1021)
A patch handling focus was recently merged, but a special condition on Windows was inverted, causing a segfault. Bug:https://github.com/ArthurSonzogni/FTXUI/issues/1020
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							@@ -104,7 +104,7 @@ jobs:
 | 
			
		||||
          --gcov-executable '${{ matrix.gcov_executable }}';
 | 
			
		||||
 | 
			
		||||
      - name: Windows - Test and coverage
 | 
			
		||||
        if: runner.os == 'Windows' && false
 | 
			
		||||
        if: runner.os == 'Windows'
 | 
			
		||||
        working-directory: ./build
 | 
			
		||||
        run: >
 | 
			
		||||
          OpenCppCoverage.exe
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,13 @@
 | 
			
		||||
Changelog
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
Unreleased
 | 
			
		||||
-----
 | 
			
		||||
 | 
			
		||||
### Component
 | 
			
		||||
- BugFix: Fix major crash on Windows affecting all components. See #1020
 | 
			
		||||
- BugFix: Fix focusRelative.
 | 
			
		||||
 | 
			
		||||
6.0.1 (2025-03-28)
 | 
			
		||||
-----
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ Decorator focusPositionRelative(float x, float y) {
 | 
			
		||||
 | 
			
		||||
    void ComputeRequirement() override {
 | 
			
		||||
      NodeDecorator::ComputeRequirement();
 | 
			
		||||
      requirement_.focused.enabled = false;
 | 
			
		||||
      requirement_.focused.enabled = true;
 | 
			
		||||
      requirement_.focused.node = this;
 | 
			
		||||
      requirement_.focused.box.x_min = int(float(requirement_.min_x) * x_);
 | 
			
		||||
      requirement_.focused.box.y_min = int(float(requirement_.min_y) * y_);
 | 
			
		||||
 
 | 
			
		||||
@@ -125,27 +125,27 @@ void Render(Screen& screen, Node* node, Selection& selection) {
 | 
			
		||||
    node->Select(selection);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Setting the cursor to the right position allow folks using CJK (China,
 | 
			
		||||
  // Japanese, Korean, ...) characters to see their [input method editor]
 | 
			
		||||
  // displayed at the right location. See [issue].
 | 
			
		||||
  //
 | 
			
		||||
  // [input method editor]:
 | 
			
		||||
  // https://en.wikipedia.org/wiki/Input_method
 | 
			
		||||
  //
 | 
			
		||||
  // [issue]:
 | 
			
		||||
  // https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
 | 
			
		||||
  //
 | 
			
		||||
  // Unfortunately, Microsoft terminal do not handle properly hiding the
 | 
			
		||||
  // cursor. Instead the character under the cursor is hidden, which is a big
 | 
			
		||||
  // problem. As a result, we can't enable setting cursor to the right
 | 
			
		||||
  // location. It will be displayed at the bottom right corner.
 | 
			
		||||
  // See:
 | 
			
		||||
  // https://github.com/microsoft/terminal/issues/1203
 | 
			
		||||
  // https://github.com/microsoft/terminal/issues/3093
 | 
			
		||||
  if (node->requirement().focused.enabled
 | 
			
		||||
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
 | 
			
		||||
      ||
 | 
			
		||||
      node->requirement().focused.cursor_shape == Screen::Cursor::Shape::Hidden
 | 
			
		||||
      // Setting the cursor to the right position allow folks using CJK (China,
 | 
			
		||||
      // Japanese, Korean, ...) characters to see their [input method editor]
 | 
			
		||||
      // displayed at the right location. See [issue].
 | 
			
		||||
      //
 | 
			
		||||
      // [input method editor]:
 | 
			
		||||
      // https://en.wikipedia.org/wiki/Input_method
 | 
			
		||||
      //
 | 
			
		||||
      // [issue]:
 | 
			
		||||
      // https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
 | 
			
		||||
      //
 | 
			
		||||
      // Unfortunately, Microsoft terminal do not handle properly hiding the
 | 
			
		||||
      // cursor. Instead the character under the cursor is hidden, which is a
 | 
			
		||||
      // big problem. As a result, we can't enable setting cursor to the right
 | 
			
		||||
      // location. It will be displayed at the bottom right corner.
 | 
			
		||||
      // See:
 | 
			
		||||
      // https://github.com/microsoft/terminal/issues/1203
 | 
			
		||||
      // https://github.com/microsoft/terminal/issues/3093
 | 
			
		||||
      &&
 | 
			
		||||
      !node->requirement().focused.cursor_shape == Screen::Cursor::Shape::Hidden
 | 
			
		||||
#endif
 | 
			
		||||
  ) {
 | 
			
		||||
    screen.SetCursor(Screen::Cursor{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user