Python console history gets rearranged when editing lines #46809
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#46809
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Debian unstable, GeForce GTX 980
Blender Version
Broken: 2.76
Short description of error
Editing lines in the Python console causes the console's history order to be manipulated in unintuitive ways. There is a certain logic to it, but that logic is different from just about every other shell in existence(*). Most importantly, it's different from Python's own interactive interpreter.
(*) Based on a sample (n=4) consisting of bash, python3, cmd.exe and Opera's Javascript console
Exact steps for others to reproduce the error
Because Python console contents are not saved, I think it's pointless to attach a .blend file.
The history order is now 42 -> 2 -> 1 -> 3 -> back to empty line.
If you press the down arrow twice between steps 4 and 5 (it cycles to 3 and then empty line), the history order becomes 3 -> 42 -> 2 -> 1 -> back to empty line. One press of the down arrow is not enough to trigger this.
Changed status to: 'Open'
Added subscriber: @tdb
Added subscriber: @mont29
Added subscriber: @ideasman42
Added subscriber: @mano-wii
I can confirm.
42 is added to the history after 2.
It should have been added to the end of the history list.
This is not technically a bug, code is supposed to work that way… Has been a long-standing TODO to revisit this and get a more usual behavior of commandline history, so moving to known issue.
Added subscriber: @Chirag-Mathur
I have been able to reproduce this issue and would like to work on this, so can anyone point me as to where to start.
I think this is similar to what happens in the MySQL command line clients, where the anchor is placed to wherever we go via the arrow keys, and the changes we do, like the 42, are added there only instead of being added to the last of the history.
Added subscriber: @mcavazotti
I'm working on this item.
From what I saw in the code, a circular linked list could simplify how the console history is implemented and could do the trick to fix this issue. However I couldn't find any circular linked list in the
blender/source/blender/blenlib
folder. Since I'm new in the dev community, I don't know if I can implement aCircularList
based onListBase
or if I should look for another solution for this task... Can anyone give me an advice about it?I don't think a circular linked list is needed, it's not such a problem to wrap to the first/last when cycling history.
The fix is in this patch [D14592 ](https://developer.blender.org/D14592), ready for review.
@ideasman42 How do I ask for someone to review my patch? I couldn't find the details about it in the wiki...
Added subscriber: @ab_stanton
Just tag them in the patch (click edit, then in reviewers type in the name of who you want to review it). If you're active in blender.chat you can always chase them up on there if you think it's getting lost, but these things take time so normally you'll have just have to wait for a good bit.
I have a patch for this, working on contributing it. It keeps track of an additional index into the history instead of trying to make it act like a ring buffer.