Python console history gets rearranged when editing lines #46809

Closed
opened 2015-11-18 11:47:06 +01:00 by Mikko Rasa · 17 comments

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.

  1. Open Python console in Blender
  2. Seed the history with the integers 1, 2 and 3 in this order
  3. Press up arrow two times to get back to 2
  4. Edit the value to 42 and press enter
  5. Press up arrow repeatedly and observe the history cycling order
    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.
**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. 1. Open Python console in Blender 2. Seed the history with the integers 1, 2 and 3 in this order 3. Press up arrow two times to get back to 2 4. Edit the value to 42 and press enter 5. Press up arrow repeatedly and observe the history cycling order 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.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @tdb

Added subscriber: @tdb
Campbell Barton self-assigned this 2015-11-18 20:37:54 +01:00

Added subscriber: @mont29

Added subscriber: @mont29
Campbell Barton removed their assignment 2016-08-03 06:34:49 +02:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Added subscriber: @mano-wii

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.

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.

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

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.

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

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 a CircularList based on ListBase or if I should look for another solution for this task... Can anyone give me an advice about it?

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 a `CircularList` based on `ListBase` 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.

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.
Matheus Cavazotti self-assigned this 2022-04-07 21:21:51 +02:00

The fix is in this patch [D14592 ](https://developer.blender.org/D14592), ready for review.

The fix is in this patch [[D14592](https://archive.blender.org/developer/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...

@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

Added subscriber: @ab_stanton

In #46809#1341424, @mcavazotti wrote:
@ideasman42 How do I ask for someone to review my patch? I couldn't find the details about it in the wiki...

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.

> In #46809#1341424, @mcavazotti wrote: > @ideasman42 How do I ask for someone to review my patch? I couldn't find the details about it in the wiki... 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.
Philipp Oeser removed the
Interest
Python API
label 2023-02-10 09:04:53 +01:00
Contributor

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.

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.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-12 05:00:20 +01:00
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#46809
No description provided.