-
Notifications
You must be signed in to change notification settings - Fork 226
New feature: panel resizing with mouse #1021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Do I need to fix any of SonarQubeCloud suggestions? |
|
@yulian5, thanks for your PR. gh-1021.mp4Functional:
Visual:
It's an interesting feature, but, as you can see, the place is pretty crowded already. |
|
@alabuzhev thank you very much for your testing and valuable inputs. Let me work on remaining issues. Thanks! |
|
Hi @alabuzhev, I have the working code which addressed all mentioned issues:
The scrollbar is excluded from mouse resize detection and works as expected, but even with the scrollbar there is still enough grip area for effective resizing even in case of a single panel (what as I see ConEmu cannot do). For next PR I need to finish vertical resizing to complete the task where option for single panel resizing will be useful as well. I need to clean up the code, add comments, check it for optimization, and then commit new changes. Do I need to modify changelog and vbuild.m4 again or it'll be done during the merge? Thanks! |
|
Do we really want to introduce a new color for this? It would be a breaking change for all custom themes. |
On the screenshot, I see that the {left panel's cell below the scroll bar where the “status” area separator joins the right-hand-side frame} is not highlighted yellow whereas the corresponding right panel's cell on its left is (no scrollbar there though). Is it for a purpose or just a bug? BTW Do we need to highlight both panels' frames? IMHO just the one being dragged is enough (at least while dragging). We might still highlight both frames on hover though to indicate that both will be affected. Also, it would be nice to handle the |
New color would be nice and flexible. But the code has to handle the missing color gracefully and use a sensible default replacement from the colors defined by the current theme. |
Don't worry about these for now. There might be more changes requested which might take a few days and resolving conflicts every time someone merges into master doesn't make much sense.
We do not have such a concept. Palette colors are independent and any missing ones will stay default aqua-on-blue-ish. |
Yes, I explained that. Colors were my first concern in this feature! |
Yes, I notice that. The scrollbar at the bottom actually expands more than it depicted and this area is clickable and it scrolls the context down. This looks like the problem with scrollbar implementation. The top part of scrollbar looks fine. We may need to create new issue for that later. |
Actually I had the similar concern. I tried to make single lines while dragging but it looked awful. You can change dragging border color to normal color, it works very nice except you cannot see when it hovered (but if you know then it's fine). It's very possible to make separate colors for havering and dragging, not a problem at all. Do we need it? It maybe very confusing. The single panel can be resized with mouse so to simplify the logic both panel borders are highlighted.
Yes, it's a very good idea, but that would be a completely separate task. Mouse and key handling in Far is quite complicated even without plugins and macros. Double click works fine for now. |
Actually, the entire panel frame below the scrollbar (and above it too) performs scrolling when clicked. It looks like a deliberate feature (with its own bugs though). But it does not justify that the resizing drag-highlight does not cover the cell I'm referring to. IMHO this should be fixed in the PR to get a more consistent look and feel.
I am not suggesting to use single-line highlighted borders, I am rather suggesting to highlight only one panel's (double-line) border. This will be consistent with resizing of a single visible panel too.
Double-click does not address the scenario when there's some non-default panel width already and the user starts dragging the panel border (maybe by a misclick). Unfortunately, double-click will not restore the pre-drag non-default layout. |
Thank you very much for detailed explanation! I updated the code. It happens to be quite a huge project! @HamRusTal |
|
Hi @alabuzhev I uploaded new code which fixed calculation of bottom border around text area for visual feedback during height resizing and fixed SonarQubeCloud issues. However CodeFactor marked the code with red cross because of complexity GetInputRecordImpl() in keboard.cpp file. That's not my code and I don't think that I need to fix it now. I just added couple small functions to block all keys during resizing and allow only Esc key to revert resizing. Please help with that! Thanks! |
It's fine to ignore. |
b285014 to
6fc16f2
Compare
|
I merged all my commits into one and updated changelog and vbuild.m4 to the latest. But GitHub doesn't merge it in PR automatically. |
|
I think we need to revert all removed empty lines back in |
I did that 2 days ago. It was my mistake. I tried to remove spaces that VS inserts without any reason. Do you see any removed single empty lines? But I converted some double empty lines to single empty lines between functions just to be consistent through the file. Only one double empty line is remaining before "namespace". |
|
Oops, it's my fault, those removed empty lines are duplicates. |
|
Hi @yegor-mialyk, I see the review is going to be long. I guess you're very busy. Do you need any help from me? I can briefly describe the algorithm and the main changes to the code. Please let me know. Thanks! |
|
|
||
| static_assert(static_cast<size_t>(panel_sort::BY_USER) == static_cast<size_t>(OPENPANELINFO_SORTMODES::SM_USER)); | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls avoid changing formatting, adding or removing lines etc. if it's not directly related to your change.
It could make sense in isolation, or subjectively look better or whatever, but all these tiny changes here and there distract from the important part and only make the reviewing longer.
|
Highlighting borders on hover and drag (visual feedback) is quite convenient and helps users use the function without any instructions. But over time, it starts to get a little annoying. I'm thinking of adding an option to disable visual feedback for experienced users. What are your thoughts on this? |
|
I have a somewhat unrelated concern, and I apologize that I have not looked at the actual change. So, here it goes: if I have mouse support turned off in |
Hi @MKadaner: Based on code analysis: The answer is: NO, there will be NO performance penalty when mouse support is turned off. As for Memory Footprint: |
I assume you mean the additional data, yet the added instructions code will be larger I believe (still not an issue IMHO). |
|
@MKadaner and @HamRusTal Nothing in this life comes for free. Here is the full estimates: x64 Release Build Footprint Estimate: Code Segment (.text): This is significantly more than initial "< 100 bytes" estimate, which only considered data variables. |
That is, of course, not a concern. Thank you for the confirmation about run-time performance being unaffected. P.S. I prefer cats over mice. |
|
@MKadaner, I myself use Far with a keyboard 95% of the time, but resizing the panels using the keyboard just drives me crazy. Here is the full code performance analysis for mouse processing from claude-4-sonnet AI comparing 2 branches. It says that now it works faster than before with mouse, except resizing. But we didn't have resizing with mouse before. However I don't know how accurate it is. Input Caching and Early Returns - optimizations from Copilot AI (however it skewed up a lot, I reverted multiple "optimizations") ProcessMouse Performance Analysis - FarManager.panel-mouse-resizing vs yulian5.master Performance Impact Analysis Performance Optimizations Added: New Mouse Processing Features Added: Performance Impact Assessment Optimizations Gained: Processing Overhead Added: Net Performance Impact: For Normal Mouse Operations (95% of usage): For Border Interactions (5% of usage): Overall Assessment: The optimizations provide a net performance gain for typical usage while adding rich mouse interaction features. The caching and conditional logic improvements more than offset the additional border processing overhead for normal operations. Recommendation: The performance optimizations are well-designed and provide both better performance for common operations and enhanced functionality for power users. P.S. According to this analysis (if it's true) it make sense to add similar optimizations in other processing code in Far. |
|
Sorry, it's too personal a question. |







Summary
The PR introduces a new feature to Far Manager: panel resizing with mouse.
References
Checklist
If not checked, I accept that this work might be rejected in favor of a different grand plan.
Details
This feature introduces the ability to resize file panels in Far Manager using the mouse.
Users can now:
This enhancement provides a more intuitive and efficient way to manage panel layouts, improving user experience for those who prefer mouse-driven interactions.
It includes updates to:
FarColorW.pas and farcolor.hpp: Defines a new palette color COL_PANELDRAGBORDER for the visual feedback during resizing.
farlang.templ.m4: Adds new localization strings for the "Dragging border" text.
filepanels.cpp and filepanels.hpp: Implements the core logic for mouse event handling, border detection, resizing, and drawing the visual feedback. This includes new MouseState enum, IsMouseOverPanelBorder, DrawBorderFeedback, ClearBorderFeedback, and ResetAllMouseStates functions.
palette.cpp and setcolor.cpp: Initializes and integrates the new COL_PANELDRAGBORDER color into the color palette and settings.
*.hlf.m4 files (e.g., FarEng.hlf.m4, FarRus.hlf.m4): Updates help files for various languages to document the new mouse resizing functionality.