Jump to content

\n in string dumps


bernhard
 Share

Recommended Posts

Hi @adrian

I'm doing some more complex RockFinder operations and need to work with the dumped SQL statement. I have the dumpSQL() method for that, but since one of the last updates the newlines show up in that output:

zQeDjZh.png

That makes it hard to copy the statement to mariadb and work on it there. Do you know how I can get rid of those \n characters?

Thx

---

Edit: I've now this quickfix in place:


  /**
   * Dump SQL of current finder to console (supports chaining)
   * @return RockFinder3
   */
  public function dumpSQL() {
    echo("<pre>".$this->getSQL()."</pre>");
    return $this;
  }

yYoAqQk.png

Not sure if there is a better solution?

PPS: That is really annoying... whenever I'm doing bd($sql) I get the newline characters in my dump... ? I think they CAN be nice to have, but often they are totally useless and annoying. Maybe an option would be nice? Or is there already one?

Link to comment
Share on other sites

Thx @adrian I've already done that, but instead of

bd($finder->getSQL());

I'd have to use

be("<pre>".$finder->getSQL()."</pre>");

now ? See examples:

Nicely formatted, but having \n:

EqLYUq5.png

No \n but a pain to read:

deZisdu.png

Nice format but hard to dump:

3gU0NvD.png

Maybe I've found a CSS solution:

.tracy-dump-string i {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

This prevents all <i> tags in the dump from being copied (at least on my chrome). Should we add that to the tracydebugger style?

QubGYy1.png

I've opened an issue at nette: https://github.com/nette/tracy/issues/458

  • Like 1
Link to comment
Share on other sites

@bernhard - that css always works for me. I see that you just started an issue with the Tracy core which is great, but I can also just add that locally to the css that I package with the module. Seems like a good solution me although I am still unsure how much benefit actually showing the \n is in the first place. Note that the code for adding these, is all here:

https://github.com/nette/tracy/blob/cf7d278957bd4301a409aa689159a9700459ff86/src/Tracy/Helpers.php#L343-L376

If there are strong opinions on this, I could potentially hack this file to remove these things, or it might be possible to convert back again in the module's code.

Link to comment
Share on other sites

Yeah, I think they are quite confusing. But I think they can also be very helpful in some situations...

MlJIELt.png

I'm also not sure about the padding on the left... Is that a core thing?

28 minutes ago, adrian said:

I could potentially hack this file to remove these things, or it might be possible to convert back again in the module's code.

The easiest would be a display:none on the <i> tags. But I'm really not sure if we should do that. It adds a lot of clarity to the dump (as one can see in the screenshot above).

Maybe something like this?

H5xHnMv.png

Not sure how to deal with it in the debug bar though ? 

Link to comment
Share on other sites

Just now, bernhard said:

Yeah thanks. I am already using his latest release (with that fix) here. I'll commit the changes sometime soon. I just need to spend a bit of time revisiting the changes I made for Pete, and also revisit everyone's suggestions for improving the settings page, and also Robin's "Shortcuts" panel idea. I'll probably commit all these things together - maybe on the weekend or early next week.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...