Skip to content
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

question: debug process of interactive mode by printing #33

Closed
zhiburt opened this issue Jun 16, 2020 · 2 comments
Closed

question: debug process of interactive mode by printing #33

zhiburt opened this issue Jun 16, 2020 · 2 comments
Labels
internal ⚙️ Internal issues or TODOs
Projects

Comments

@zhiburt
Copy link
Contributor

zhiburt commented Jun 16, 2020

Summary

Putting something in stdout frequently be a caused issues of displaying correct interface. I guess it's related to the usage of raw_mode.

Why it has a little importance because in debuging process you think that any issue may be caused by the debug changes.

For example adding a debug message in select_next will not work out properly.

     pub fn select_next(&mut self) {
+        dbg!(&self.pick_idx);
         self.pick_idx = (self.pick_idx + 1).rem_euclid(self.n_items);
     }

It copy the chosen line on each typing.

error: spellcheck(Hunspell)
    --> /home/zhiburt/proj/cargo-spellcheck/src/literalset.rs:176
     |
 176 |  but also the `LineColumn` in the proc_macro2 context.
     |                                   ^^^^^^^^^^^

(6/8) Apply this suggestion [y,n,q,a,d,j,e,?]?
 » macrocosmic
   ...

After some typing

   ...
   macrocosmic
 » macrocosmic
 » macrocosmic
 » macrocosmic
 » macrocosmic
 » macrocosmic
   macrocosmic
   macrocosmic
   macrocosmic
 » ...

Might debugging information to file here is not a bad idea? Or it's a bad idea ...

Context

  • Prior discussion: low
@zhiburt zhiburt changed the title Dirty debug process of interactive mode debug process of interactive mode by printing Jun 16, 2020
@zhiburt zhiburt changed the title debug process of interactive mode by printing question: debug process of interactive mode by printing Jun 16, 2020
@drahnr
Copy link
Owner

drahnr commented Jun 16, 2020

The only workaround I can currently see, is to use the ScopedRaw on a more granular level. But I am not sure if done too tightly, around read!(..) that we might queued events - frankly I know too little about the terminal mechanics to make a good judgement here.

But I fully agree that the current situation is not optimal - one way is to avoid debugging by means of println! and resort to lldb, but that might be not satisfactory for issues on a bigger scale which are being triaged.

@drahnr drahnr added the internal ⚙️ Internal issues or TODOs label Jun 16, 2020
@drahnr drahnr added this to To Do in Overview Jul 8, 2020
@drahnr
Copy link
Owner

drahnr commented Aug 20, 2020

Frankly, I think the only sane approach for this is to use a debugger like lldb besides what is already said.

@drahnr drahnr closed this as completed Aug 20, 2020
Overview automation moved this from To Do to Done Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal ⚙️ Internal issues or TODOs
Projects
Overview
  
Done
Development

No branches or pull requests

2 participants