Hacker News new | ask | show | jobs
by eriknstr 3256 days ago
Filling the indent area with dots is not a sensible default IMO. Often when I work on a query I am going to reuse it in an application. If PgAdmin III or psql filled the indent area with dots then they would be included when I copied the query I'd written.

Even though I always reformat the query, and even though the text editor I use -- vim / neo-vim -- supports rectangular text selection, I would be annoyed at such dots.

2 comments

Don't fill it with dots, use it. This is my shell prompt. I break after the '%', so that long commands use as much of a line as possible, and I break before the prompt, because I like to visibly separate operations.

  aaron@tesla ~ % 
  pwd
  /home/aaron
  
  aaron@tesla ~ % 
  cd Projects 
  
  aaron@tesla ~/Projects % 
  pwd
  /home/aaron/Projects
  
  aaron@tesla ~/Projects %
This is what my shell prompt looks like:

    : stuff; 
If you copy the entire line, stuff is arguments to the ‘:’ command, which does nothing. (This does mean stuff can't contain unmatched shell special characters.)

I think this was invented in the Blit era by someone I've forgotten.

I do something similar which is based on the Cygwin default bash prompt:

    PS1='\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n# '
Looks like:

    root@myhost.name /etc/httpd/conf
    #
That's good to know. Perhaps I should replace the dots with empty space. I'll do that if we get more requests for it.

Thank you for the feedback.

Empty space would be the better default I think yes.
Definitely empty space!
Same, dots are obnoxious when copy-pasting.
The Python REPL notoriously uses >>>/... like in the screenshot, ẃith the effect that e.g. IPython has a special paste-from-repl magic just to remove these.
Or alternatively the prompt character could start on a new line. That way you can have smaller windows fit more query per line with less space wasted on white-space.
But in return you might use more vertical space, and with a terminal size of 80x24, vertical space is more precious.
With the "newline after prompt" scheme, you only get one extra line per query.

Which, if the query is long (e.g. longer than 20+ lines) it's not gonna make any difference anyway -- it's not like it matters if you can fit e.g. 24 or 23 lines of a 30 line query (besides, the result rows are gonna take much more vertical space, further making the measly 1 extra line issue moot).

As for for multiple small queries (and one extra line after each of those prompts), you can always scroll. And, again, the results are gonna take far more vertical space than the single extra line per prompt.

And, of course, with the full horizontal space available (and not half wasted by dots) you get to fit more characters in each line, and thus your queries will probably end up using FEWER lines.

So, not only the extra line from the "newline after prompt" is no big deal vertical-space wise, but the dot scheme wastes MORE vertical space AND renders queries unpastable.

While you are data gathering, I will half-vote the other way.

In VIM I make my whitespace visible, and just live with the consequences when I cut an paste. That said, I most of my empty spaces are still invisible, I only show tabs and trailing spaces.

Well, an editor should not copy whitespace visibility characters in the first place.
Don't want to pile on, but yes to empty spaces
The dots are my biggest gripe about pgcli. That would be an awesome change!
You can change this to an empty space via the config file right now. In ~/.config/pgcli/config look for continuation prompt and set it to empty string.