Skip to content

Fix issue #20: reset sentence color on text change (line number only)#41

Open
jaybutani1793 wants to merge 7 commits intokovzol:masterfrom
jaybutani1793:fix-issue-20-sentence-color
Open

Fix issue #20: reset sentence color on text change (line number only)#41
jaybutani1793 wants to merge 7 commits intokovzol:masterfrom
jaybutani1793:fix-issue-20-sentence-color

Conversation

@jaybutani1793
Copy link
Copy Markdown
Contributor

Fix issue #20: reset sentence color on text change

Problem

Currently, after evaluating a sentence, the entire line background is colored (red/green).
However, according to the expected behavior:

  • Only the "line number" should be colored
  • Full line background coloring should be reserved for marking prerequisites

Additionally, the color was not resetting when the sentence text was modified.

Solution

  • Updated coloring logic to apply color only to the line number column
  • Removed full-row background coloring
  • Ensured that color is reset when the sentence is edited
  • Used setForeground() instead of setBackground()

Result

  • ✔ Only line numbers are colored (correct UI behavior)
  • ✔ Colors reset immediately when the sentence is modified
  • ✔ UI now matches expected design and improves clarity

Testing

  1. Enter a valid formula → evaluate → line number turns green
  2. Enter an invalid formula → evaluate → line number turns red
  3. Modify the sentence → color resets automatically
  4. No full-row background coloring occurs

Remove sentence_set_bg() calls from evaluate_line() that were painting
the entire entry widget background green/red on evaluation.

The line number foreground color (gtk_widget_override_color on sen->line_no)
already provides the correct visual feedback — only the line number text
changes color (green=true, red=error), leaving the row background untouched.

Also remove the matching sentence_set_bg(BG_COLOR_DEFAULT) reset in
sentence_text_changed() since we no longer paint the entry background.
@kovzol
Copy link
Copy Markdown
Owner

kovzol commented Mar 25, 2026

Thanks for your work on this!
Your change is much better than it was, but it does not consider yet that former versions of Aris already have a partial implementation of the line number coloring:

image

That is, the background of the line numbers are colored to green in some cases (I guess, only for the conclusions, but I am not completely sure).

Do you have another suggestion to be in line with the former functionality? Thanks in advance.

@jaybutani1793
Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out!
You're absolutely right — I missed the existing partial implementation where the line number background is already used. That’s an important detail.

To better align with the previous behavior, I’ll refine the approach as follows:

Preserve the existing background coloring logic for line numbers (like conclusions)
Avoid overriding or conflicting with that behavior
Apply evaluation feedback using a non-intrusive method (e.g., foreground/text color or conditional styling only when needed)
Ensure that editing the sentence resets only the evaluation state, without affecting the original background semantics

This should keep the UI consistent with the original design while still solving issue #20 properly.

@jaybutani1793 jaybutani1793 force-pushed the fix-issue-20-sentence-color branch 2 times, most recently from fc21072 to 69c8a83 Compare March 29, 2026 05:29
@jaybutani1793 jaybutani1793 force-pushed the fix-issue-20-sentence-color branch from 9439158 to 336b202 Compare March 29, 2026 05:41
Copy link
Copy Markdown
Contributor Author

@jaybutani1793 jaybutani1793 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I’ve updated the implementation to preserve existing background coloring and use only text color for evaluation. Editing now resets only the evaluation state. Also removed unintended file changes. This should now align with previous behavior and fix issue #20.

@kovzol
Copy link
Copy Markdown
Owner

kovzol commented Mar 31, 2026

Thanks, I'll have a look soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants