Joint stream with Joe Tannenbaum
Joe Tannenbaum and I pair on scrolling for a terminal UI: slicing the wrapped lines to fit the screen, clamping the scroll position, and working out auto-scroll.
Everything we said
Aaron Francis
All right. It looks like... Let's check the profile here. Hey, there we go. Hey, we're both there.
Joe Tannenbaum
Hey.
Aaron Francis
Look at that.
Joe Tannenbaum
There we go.
Aaron Francis
Okay.
Joe Tannenbaum
Infinity, infinity stream.
Aaron Francis
Uh-huh. We'll start to see... We should start to see a little bit of the chat. Uh, oh, you can't see the chat, so if you wanted to pull up, um, uh-
Joe Tannenbaum
Oh, just pull it up separately.
Aaron Francis
Yeah, Twitter chat-
Joe Tannenbaum
Yeah, let's see
Aaron Francis
... or YouTube chat, or you could pull up, you could pull up this actual stream and put it on mute and watch the chat over there, but that's a little-
Joe Tannenbaum
Yeah. Maybe I'll-
Aaron Francis
Let's see.
Joe Tannenbaum
Yeah. We'll go to Twitter and sure.
Aaron Francis
And I think it auto-tweeted for me. Joint stream with Joe Tannenbaum. There we go.
Joe Tannenbaum
Mm-mm.
Aaron Francis
Okay. And let's make sure we are on YouTube as well.
Joe Tannenbaum
Oh, it'd be cool if I just didn't have to play it. I think I can just not play it and I can still see the chat, I think is how it works. I'm not really sure.
Aaron Francis
Smart.
Joe Tannenbaum
I see a chat window. Guess, I guess we'll see.
Aaron Francis
Smart, smart, smart, smart. Okay, if anyone is here, please start chatting so we can see that it is working. I have overlaid Joe over the chat just a little bit, but that should be fine. Oh, there we go. All right. It looks like, uh, chat is coming through on Twitter, but I'm not seeing chat coming through on Restream.
Hm. I don't know. I think Restream changed a bunch of stuff. It is working on Twitter.
Joe Tannenbaum
Is it? No, no, no, I'm not.
Aaron Francis
I see chat on Twitter. I see-
Joe Tannenbaum
Oh, okay. I see a chat here
Aaron Francis
... Restream chat coming in. All right. Restream chat, refresh. Hey, there's some Twitch chat. There's a LinkedIn chat. I see Restream telling me that it's ready. Oh, there we go. Now we're starting. All right. So we missed a few, but now they're coming in. Looking good today. That's the kind of chat I wanna hear.
Joe Tannenbaum
Yeah, yeah.
Aaron Francis
Looking good today.
Joe Tannenbaum
Keep, keep that banter up.
Aaron Francis
Yeah, appreciate it. Keep that one coming. We like that. Okay. Yes, we are working on our, um, we're working on the TUI. Um, quick question for you, Joe. What is a TUI?
Joe Tannenbaum
A TUI's a text-based user interface, so conventional interface built via concatenating strings together to make it look like a real thing, or as real-
Aaron Francis
Okay
Joe Tannenbaum
... as you wanna make it, to be honest.
Aaron Francis
Okay.
Joe Tannenbaum
Yeah. And in our case, uh, you can build them anywhere, but we are building them in the terminal primarily, because that's the only way you can build interfaces in the terminal. You can't... There's no graphical interface, it's just a bunch of text, so.
Aaron Francis
Okay.
Joe Tannenbaum
Yeah.
Aaron Francis
So it's-
Joe Tannenbaum
That's a TUI
Aaron Francis
... it's text, not terminal. I kind of thought it was terminal, but I like text. Um-
Joe Tannenbaum
Oh, yeah. Text. Text, yeah.
Aaron Francis
We just happen to be doing it in the terminal. Um, okay. I have, I've gotten some notes that my audio is low, but I just turned down Joe, so, uh, I think we should be more-
Joe Tannenbaum
Okay
Aaron Francis
... even now. So if I'm still low compared to Joe, please let me know. Otherwise, we're just gonna power through. Hey, Nate.
Joe Tannenbaum
Cool.
Aaron Francis
Um, okay. So here's what, uh, here's what we were working with when we last left off, and what I need you for is I don't actually know how to do any of this, so that's the problem. You... I, I watched, I watched your Laracast course, and then just kind of like took off into the wilderness by myself, um, and-
Joe Tannenbaum
But, but so confidently. I mean, you, you immediately were like- ... "We should use loopables," and I was like, "Oh, we're going loopables right away. I love this. This is great."
Aaron Francis
I know. That is one of my great strengths is being very confident- ... even in the face of ignorance. Um, okay, so we have app dev, which great first start, 'cause this is, this is broken.
Joe Tannenbaum
Uh-huh. Okay, cool.
Aaron Francis
Um, but, um, one of the problems here, uh, so we're, we've like scrolled the menu off the screen, but if you hit the right arrow, you can kind of see what it's supposed to look like. Um-
Joe Tannenbaum
Right
Aaron Francis
... and so I think one thing... Let's see. Where do we wanna start? One, I want, I wanna have this like, uh, middle window part, like this part here, I need that to be scrollable. Um-
Joe Tannenbaum
Okay
Aaron Francis
... I also want these tabs to be more consistently pinned to the top, and the, like the hot keys more consistent-
Joe Tannenbaum
Oh, you're moving it around right now.
Aaron Francis
Yeah.
Joe Tannenbaum
Okay.
Aaron Francis
So like that. Something weird is happening there.
Joe Tannenbaum
Show me. Oh, well first of all, that, uh, is that just the logs? Is that what's happening? Yeah.
Aaron Francis
That's the logs.
Joe Tannenbaum
Okay, so you're getting-
Aaron Francis
Yeah
Joe Tannenbaum
... you're getting real logs, so you're, you're getting too much information.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
So immediately we need to just like confine that to the height of the terminal, and also it looks like we need to do some like wrapping here, 'cause I think you're getting, uh-
Aaron Francis
Oh. Oh, oh, oh, oh, oh
Joe Tannenbaum
... lines that are too long, and so it's, it's getting a little confused. So let's look at, let's, let's start there.
Aaron Francis
I see.
Joe Tannenbaum
Let's look at that.
Aaron Francis
Okay.
Joe Tannenbaum
And we can get that scrolling.
Aaron Francis
Um-
Joe Tannenbaum
I assume you kind of want the logs to scroll, I would say.
Aaron Francis
I do, yeah. I want people-
Joe Tannenbaum
Okay
Aaron Francis
... um, I want people to be able to pause the output. Um-
Joe Tannenbaum
Okay.
Aaron Francis
Well, I don't know. I at least want people to be able to scroll back and see the stuff that was happening before, if that makes sense.
Joe Tannenbaum
Okay, let's start there. That's a good place to start.
Aaron Francis
Okay.
Joe Tannenbaum
I like that.
Aaron Francis
Okay. So here's kind of the, um, here's the setup. I have this dashboard renderer.
Joe Tannenbaum
Okay.
Aaron Francis
Um, and I kind of stole, I stole your concept of tabs here. Um-
Joe Tannenbaum
Right
Aaron Francis
... and then I think you're right. I didn't account for line wrapping. So this is where I say, "Take the last 20 lines and just throw them out into- Throw 'em out into the, the terminal. And we are, we are on tuple
Joe Tannenbaum
So it's already coming in as individual lines, right?
Aaron Francis
It's coming in as individual lines.
Joe Tannenbaum
It's already coming in.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
Okay. That's good.
Aaron Francis
Um, so if you look over here, um, it's like gathers, gathers output, uh, keeps track of the latest output and explodes it by line, and it just keeps track of the last 500.
Joe Tannenbaum
Okay. Yeah. Perfect. All right, so let's let me merge this line. Yeah. Okay.
Aaron Francis
And the lines are just up here.
Joe Tannenbaum
Very cool. Like that.
Aaron Francis
So-
Joe Tannenbaum
Great
Aaron Francis
... eh, good idea, bad idea, I don't know, but, um-
Joe Tannenbaum
Perfect
Aaron Francis
... it's working.
Joe Tannenbaum
Um, so we can do this-
Aaron Francis
Okay
Joe Tannenbaum
... one of two ways. As lines come in, we can wrap them-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... and then make those individual lines themselves. So basically, like, if you-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... I'm just gonna type some nonsense in here-
Aaron Francis
Yeah
Joe Tannenbaum
... for a second. If you have-
Aaron Francis
Yeah, this is awesome. Look at this
Joe Tannenbaum
... a very long line, um-
Aaron Francis
Uh-huh
Joe Tannenbaum
... we can, we can word wrap all of those, re-explode them, and then make it a very long, and then the next array item would be line. And then we just have a consistent behavior here, which is, like, we can take 20 of those. So the only, the only caveat there is that the gathers output would have to know, like, how wide the area is, which is not a big deal.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
We could pass that along. Um, or we can handle it here, which is a little bit messier, but not the end of the world. Where would you like to do that?
Aaron Francis
Um, I have a preference.
Joe Tannenbaum
Okay.
Aaron Francis
Um, I would prefer to handle it in the renderer. This feels like a rendering-
Joe Tannenbaum
Okay
Aaron Francis
... concern. The fact-
Joe Tannenbaum
Okay
Aaron Francis
... that, uh, the command or the terminal width changes feels like the, the gathers output should keep track of all the logs and the renderer should, uh, adjust them as, as necessary.
Joe Tannenbaum
Little, little separation of concerns here. Um, I'm-
Aaron Francis
Yep
Joe Tannenbaum
... I dig it.
Aaron Francis
Yeah.
Joe Tannenbaum
Um, okay. So, so, um, here's what-- Do you want-- Like, my approach, I think, would be, uh, do you want me to just type some stuff out and you see if you dig it? Or do you want to-
Aaron Francis
Yeah
Joe Tannenbaum
... talk through it? Okay.
Aaron Francis
No.
Joe Tannenbaum
Um, we know we're, we're saying we have space for basically 20 lines. We know that, right?
Aaron Francis
Uh, it-
Joe Tannenbaum
That's what it basically is saying for now
Aaron Francis
... that's what we're doing. I don't know if we know that, but yeah.
Joe Tannenbaum
For now. Okay.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
So, uh, before we do the each line, what I would do is I would flat map this-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... and I would say, um, so we're just getting the individual lines here. So, uh, line... Okay.
Aaron Francis
Oh, yeah, your key bindings are all off.
Joe Tannenbaum
Maybe.
Aaron Francis
Yeah.
Joe Tannenbaum
So line equals word wrap, and-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... uh, we need... Do we have a width somewhere set somewhere? Oh, I see a width up here. We can use that.
Aaron Francis
Uh, yeah. I think it's, I think it's up there.
Joe Tannenbaum
Width. Okay. So we're gonna word wrap the line to, we're actually gonna use this, which I think is string. No, what is the, uh, what is the argument name? Am I not getting a hover? I don't see a hover.
Aaron Francis
Oh, here. I'll do it. I'm gonna-
Joe Tannenbaum
Are you getting a hover? Uh, string-
Aaron Francis
String width break cut
Joe Tannenbaum
... yeah. Okay. So if we take, uh, this line-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... and then we do, uh, yep, width. Okay. You're with me. Um, and then we also want to cut long words. Cut long words true. Okay. So whoop, and then we return. It's the little-
Aaron Francis
You're operating, you're operating in a foreign environment here too.
Joe Tannenbaum
Uh, PHP end of line, uh, line.
Aaron Francis
Oh, okay.
Joe Tannenbaum
And so that's gonna give us that, and then we retake the last 20, meaning, like, whatever the resulting-
Aaron Francis
Oh
Joe Tannenbaum
... we may now have more lines there.
Aaron Francis
Uh-huh. Uh-huh. Uh-huh.
Joe Tannenbaum
Uh, but they should've been flat mapped down to like a, a flattened array, and now, now we should be ready to roll. I don't know-
Aaron Francis
Okay. This is clever. So-
Joe Tannenbaum
I think we're saving, but I don't know.
Aaron Francis
Yeah, I don't-- I'll take over. So we're taking the last 20 to-
Joe Tannenbaum
Yeah
Aaron Francis
... limit how much we have to flat map, and then-
Joe Tannenbaum
Right
Aaron Francis
... we'll likely end up with a few extra, so we're taking the last 20 again.
Joe Tannenbaum
Yeah.
Aaron Francis
Um, so now if we stop that-
Joe Tannenbaum
Maybe. Hopefully
Aaron Francis
... and start it again. Hey, that worked. That worked great.
Joe Tannenbaum
Come on.
Aaron Francis
Look at that.
Joe Tannenbaum
Great. Love that.
Aaron Francis
Okay.
Joe Tannenbaum
Okay.
Aaron Francis
Um-
Joe Tannenbaum
So now we have that.
Aaron Francis
So then here's the other thing. Um, so we're on logs. We have at least 20 lines, which needs to be calculated better. Then you switch to JavaScript and look at where the hotkeys go. So help me understand. You see how the hotkeys pop up?
Joe Tannenbaum
Yep. Yep.
Aaron Francis
Help me understand what, uh, what pin to bottom does, if not-
Joe Tannenbaum
Yeah. That's interesting
Aaron Francis
... pin it to bottom.
Joe Tannenbaum
Um, well, I wonder if we're potentially, uh, our height and our, our, our 20 is not matching up correctly.
Aaron Francis
Oh.
Joe Tannenbaum
Meaning, like, maybe 20's too-
Aaron Francis
Oh, oh, oh, oh
Joe Tannenbaum
... too much. Uh, do you wanna just dump height real quick and just see what-
Aaron Francis
Yes
Joe Tannenbaum
... the value is? Oh, by the way-
Aaron Francis
Yeah
Joe Tannenbaum
... um, we should run this with no alt screen, 'cause as soon as you dump, it's gonna, like, bounce the alt screen 'cause it thinks-
Aaron Francis
Yeah
Joe Tannenbaum
... something crazy happened.
Aaron Francis
That was, that was weird to me. Um, so tell me again what it is. It's-
Joe Tannenbaum
So it's, uh, no, br-br-br, alt screen. I built this in for myself 'cause I got so tired of disabling it and then run-
Aaron Francis
Oh, this is, this is not like a system thing? This is a Joe thing?
Joe Tannenbaum
This is a Joe thing, yeah.
Aaron Francis
Okay.
Joe Tannenbaum
This is a me thing.
Aaron Francis
Okay.
Joe Tannenbaum
So and then, and now, now AR app dev, I'm gonna let you t- do most of the typing here-
Aaron Francis
Yeah
Joe Tannenbaum
... since I'm bothering you.
Aaron Francis
Uh, AR app dev. I just turned Joe up, so sorry about the, the audio. I, you know, we'll figure it out. Um, okay. 21 is the height.
Joe Tannenbaum
Oh, oh, oh. 21. So, so yeah, we have too many, we're taking too many lines.
Aaron Francis
I see.
Joe Tannenbaum
So let's actually make this official. Instead of 20-
Aaron Francis
Yes
Joe Tannenbaum
... we know we've got a line of tabs. Uh, we probably have three lines up top, and let's say two lines on the bottom, so let's just say six. So just say height minus six.
Aaron Francis
So we'll say height less six. And then we'll come here and-
Joe Tannenbaum
And then we should have a better scenario Uh, except you went negative that, I believe, right?
Aaron Francis
Correct. The last one.
Joe Tannenbaum
It was even the last of that. Yeah.
Aaron Francis
Um-
Joe Tannenbaum
Now we should be hopefully in a better place.
Aaron Francis
We should be at least in a consistent place. There we go.
Joe Tannenbaum
Oh, baby. That's what I'm talking about.
Aaron Francis
There we go.
Joe Tannenbaum
So we can always adjust that to how much height we think we actually are taking up with other elements on the, the screen.
Aaron Francis
Right. Okay.
Joe Tannenbaum
'Cause it looks like it's, it looks like it's one, two... And we already are buffering height, so we may not-- We could adjust that value-
Aaron Francis
Ah
Joe Tannenbaum
... according to, you know, what we actually need.
Aaron Francis
Okay. So-
Joe Tannenbaum
Oh, yeah. That looks great. Cool.
Aaron Francis
Um, okay. So I wanna move these all the way to the top. Why is it being centered, uh, vertically? Is that something I've done?
Joe Tannenbaum
Uh, I don't know. Let's see. Uh, center horizontally.
Aaron Francis
Center horizontally.
Joe Tannenbaum
It might be because-
Aaron Francis
Do we have a-
Joe Tannenbaum
Well, we're, we're doing minus... Wait, center horizontally. Oh, well, here, first of all. Wait, tabs implode. Oh, okay. That's fine. New line. Let's just say, this might totally break it, so just like, you know, we'll see. But let's see if that does something. Oh, I can't switch via tab.
Aaron Francis
Yeah. I'll switch.
Joe Tannenbaum
You, you switched to that. Uh, see if that breaks it or does anything. Hmm, you do have a, kind of a big buffer up top there, huh?
Aaron Francis
Right?
Joe Tannenbaum
Uh...
Aaron Francis
We hate a big buffer. We hate it. Um, so you keep-
Joe Tannenbaum
Yeah, I'm not really sure, to be honest
Aaron Francis
... you keep thinking.
Joe Tannenbaum
Yeah, I'm not sure.
Aaron Francis
Let's, uh-
Joe Tannenbaum
We'll have to figure that out.
Aaron Francis
Let's do-
Joe Tannenbaum
Uh-
Aaron Francis
And okay, so I need to answer two questions in chat. Uh, Joe is the creator, Joe's the creator of the library that I'm using here, also a Laravel employee. That's who Joe is. That's why he's here, 'cause he knows how to do these things and I do not.
Joe Tannenbaum
So he's not Joe.
Aaron Francis
Yeah. Not a-- This person says, "Not a Laravel dev. Who's Joe?" Great question. Great question. Um, let's find Twitter/joetanenbaum. There you go.
Joe Tannenbaum
Joe Killer. Wow, okay.
Aaron Francis
Yeah, I don't know who that is. That's Joe. Joe is the creator of Chewy, which is what we're working on-
Joe Tannenbaum
Yeah
Aaron Francis
... right now. Um, okay. So coming back here. Oh, the other question, how many of those sweaters do you own? Let's pretend it's a lot. It's actually just one. Um, but let's pretend it's not just one that is, hasn't been washed. It's just so, it's just so comfy. I have to have it.
Joe Tannenbaum
Do you have... So this, this hoodie, uh, since Laracon, has just, like, lived on the back of my chair, and I just throw it on-
Aaron Francis
Yeah
Joe Tannenbaum
... whenever I'm working.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
Is that what you, is that the, that's the game? And I kind of have it in rotation, like, after, like, a week, I'm like, "Oh, I should probably-"
Aaron Francis
Yeah, except-
Joe Tannenbaum
"... chuck this in the laundry."
Aaron Francis
Um, I don't know if this is, like, a me thing or a guy thing. I, I'm, I know it's not a my wife thing. I have a little pile of clothes next to my bed, um-
Joe Tannenbaum
Uh-huh
Aaron Francis
... that's, like, neither clean nor dirty, but it always is there. So it's like, I'll take off some clothes and I'm like, "Ah, I didn't really get those clothes dirty. Let's just leave those next-"
Joe Tannenbaum
Didn't get proper use here.
Aaron Francis
Let's, yeah-
Joe Tannenbaum
Yeah
Aaron Francis
... let's put those in a little holding pattern. We'll keep those right there. And then I wake up the next morning, and I look at the little pile and I'm like, "Yeah, I'm gonna wear that again," and I put the sweater back on.
Joe Tannenbaum
Okay.
Aaron Francis
So the s- the sweater goes into, like, the holding pattern pile. So neither clean nor dirty.
Joe Tannenbaum
I kind of have that pile on top of my dresser a little bit, I would say.
Aaron Francis
See? There you go.
Joe Tannenbaum
It's less formal than all that, but yeah, sure.
Aaron Francis
So if we did this, let's say, um, let's just-
Joe Tannenbaum
Yeah, I'm curious, like, if we just do a line up there
Aaron Francis
... let's just render the tabs. Oh, you wanna do just a line? So if we did this line. Hey, y'all.
Joe Tannenbaum
Just to see if that is even buffered down.
Aaron Francis
Return this. Need a semicolon here. Guess I don't have to clear with an alt screen. See? That's wild, right? The floordrobe.
Joe Tannenbaum
Hmm.
Aaron Francis
The clothes buffer. That's funny.
Joe Tannenbaum
The floordrobe is great. The floordrobe is really good.
Aaron Francis
I feel like the floor, the floordrobe is mine now. Um, okay. So what do we think about-
Joe Tannenbaum
Yeah, what's up with that? That's just, uh... Oh. Oh, is your line height insane? Do you, you've, you've spaced-
Aaron Francis
No, I don't have tailor, I don't have tailor line height. Um-
Joe Tannenbaum
'Cause you're not, you can't even select further up, which m- makes me think that the prompt is moving way down out the gate. Oh. Hmm. Can you open up, like, uh, the Mac terminal and run this?
Aaron Francis
Um-
Joe Tannenbaum
Like the, the, the normal one. Oh boy, I'm asking you to, like, do a bunch of stuff here. Okay.
Aaron Francis
Yeah. So this feels like the Mac terminal. Um, where am I? Uh, okay. So I want code, probably Live OS. I, I don't think I've ever used this. Um-
Joe Tannenbaum
I know, yeah.
Aaron Francis
And it's just the same thing. Come on, Aaron. It's the exact same thing.
Joe Tannenbaum
What are you doing over there? Or what am I doing over there?
Aaron Francis
What are you doing over there?
Joe Tannenbaum
Somebody, somebody's doing something.
Aaron Francis
Yeah, who's doing that?
Joe Tannenbaum
Uh, okay.
Aaron Francis
Hey, Sam, dude.
Joe Tannenbaum
Let's, let's go back to the code real quick.
Aaron Francis
Ooh, let's, let's just check, uh, let's check the actual command and see if we're doing something wonky there. Let's go to dev. Oh, nope. Just new dashboard run. This is all just registering commands. New dashboard run. Show dashboard.
Listen, do some stuff, do some stuff. Loop this render. Init dimensions.
Joe Tannenbaum
I wonder if, uh... No, it shouldn't be. What is init dimensions? What is that?
Aaron Francis
I don't know.
Joe Tannenbaum
Oh, no. Init dimensions just gets the, it just gets the width and height of the terminal. So that's, that's like a... Uh, question. Are, if you, uh, if you disable any of the commands just for a second, so, like, remove all the commands and see if something is outputting before it gets to where we're going.
Aaron Francis
Mm-hmm. Mm-hmm.
Joe Tannenbaum
I'm just curious.
Aaron Francis
And those don't need to be. Just this one and this one Be no, well, yeah
Joe Tannenbaum
You can, you can close out the other one if you want.
Aaron Francis
Yeah. Still-
Joe Tannenbaum
What in the world?
Aaron Francis
All right. Let's keep going. We'll figure that out later.
Joe Tannenbaum
Mm. Yeah. Okay.
Aaron Francis
Rather, I'll let you figure that out later. Um, okay. So what I need to do now is let's just check to see where we're at. So if we kill that, we're still at, "Hey y'all." We need to clear that out for dashboard renderer. So for some reason, we have some buffer up here.
That's fine.
Joe Tannenbaum
We'll figure it out later.
Aaron Francis
We'll get rid of that later. Um-
Joe Tannenbaum
Easily adjustable.
Aaron Francis
Yep. Okay. How in the world, um... This needs to be, this needs to be, stack traces need to be prettier, but that's just, that's wild.
Joe Tannenbaum
Yeah.
Aaron Francis
Um-
Joe Tannenbaum
Yeah.
Aaron Francis
How would we get a scroll, like a scrolling panel in here?
Joe Tannenbaum
Okay. So Proms has this kind of built in. Jess is-- This is like so astoundingly hard to do, and Jess-
Aaron Francis
Yes
Joe Tannenbaum
... has like built it in, in like a method, which is like so impressive. If you don't know, uh, for people on stream, Jess Archer, uh, one of the most brilliant people that I know. She's, she's, she's lovely and intimidating and, uh, she's a lovely person, but she's so smart. Um, so-
Aaron Francis
Yes. Which is the intimidating part
Joe Tannenbaum
... she built Proms, which is the base of this entire thing. Um-
Aaron Francis
Jess, what's, what's, what's her Twitter?
Joe Tannenbaum
Uh, oh, I wanna say Jess Archer Co- Codes? Jess Archer-
Aaron Francis
Yeah
Joe Tannenbaum
... Jess Archer Codes. Yeah.
Aaron Francis
Go follow her.
Joe Tannenbaum
She's amazing.
Aaron Francis
She's incredible. Um, so yes, definitely go follow Jess. All right. So she built something.
Joe Tannenbaum
She's also-- I'm just gonna say, if you're following Laracon AU, she's gonna blow some minds next week. I'm just saying.
Aaron Francis
Oh, I'm so excited.
Joe Tannenbaum
It's gonna be, it's gonna be incredible.
Aaron Francis
I know what it is-
Joe Tannenbaum
I just saw it
Aaron Francis
... but I haven't seen it yet.
Joe Tannenbaum
Oh, dude. When-
Aaron Francis
I know
Joe Tannenbaum
... when the reveal happens, it, like the audience is gonna . Like it's just gonna be... I mean, I've done it every time I've seen the demo. It's just-
Aaron Francis
I can't, I cannot wait
Joe Tannenbaum
... it's so good.
Aaron Francis
I cannot wait.
Joe Tannenbaum
It's so good.
Aaron Francis
Okay. Also-
Joe Tannenbaum
Uh-
Aaron Francis
... while we're talking about how great Jess is, mom to twins, so very near and dear to my heart.
Joe Tannenbaum
Indeed.
Aaron Francis
I think hers-
Joe Tannenbaum
I believe much older twins than, than yours are
Aaron Francis
... much older. I think hers are like-
Joe Tannenbaum
Yeah
Aaron Francis
... 10 or 11 or something like that.
Joe Tannenbaum
Something like that, yeah. Yeah.
Aaron Francis
All right.
Joe Tannenbaum
Uh, but a-
Aaron Francis
Oh, hey. Hugo's here
Joe Tannenbaum
... a family, twin family. Um, okay. Let's make something scrollable. Let's go to, um... Here's how it works.
Aaron Francis
I imagine here-
Joe Tannenbaum
We're gonna add to the renderer, draw sc- scroll bars, I believe it's called, as a trait.
Aaron Francis
Okay.
Joe Tannenbaum
Okay. It draws-
Aaron Francis
Scroll, scroll. Oops
Joe Tannenbaum
... scroll bars, yeah. And this is not me, this is Jess. Um-
Aaron Francis
Okay
Joe Tannenbaum
... so we're gonna have a scroll bar. We need to show the lines that are visible. Here, if you wanna pop into that actually-
Aaron Francis
Uh-huh
Joe Tannenbaum
... uh, to the traits. So we have that scroll bar method, which is the magic bit. We have the visible lines.
Aaron Francis
Okay.
Joe Tannenbaum
What is the index of the first visible item, so that we know where, how to position that scroll bar on the side. The height of the area that we're working with, how many items total, and what's the width of the area. Those are the... I know it sounds like a lot, but like those are the things we have to pass in, and then we magically get-
Aaron Francis
Yeah. I'm just gonna monkey with this a little bit-
Joe Tannenbaum
... a bunch of lines-
Aaron Francis
... just so I can read it
Joe Tannenbaum
... in a scroll bar.
Aaron Francis
Okay. So we need to pass in-
Joe Tannenbaum
Don't worry about the coloring. I'm sure we're fine.
Aaron Francis
We need to-- Yeah, we need to pass in what's visible.
Joe Tannenbaum
Mm-hmm.
Aaron Francis
Is that, um-
Joe Tannenbaum
But basically that's visible-
Aaron Francis
... not visible within the window? Is that visible across everything?
Joe Tannenbaum
No. Visible in the window.
Aaron Francis
Or is that visible in the window?
Joe Tannenbaum
So this, this methodology-
Aaron Francis
Okay
Joe Tannenbaum
... of doing this, uh, while in the renderer may not ultimately-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... work as a plan because we actually need to know how many total lines there are, so we may need to pre-word wrap some of this stuff and shove it in the proper array that you're originally working with. Do you know what I'm saying?
Aaron Francis
Barely, but let's keep going.
Joe Tannenbaum
Okay.
Aaron Francis
So if we, so we, we have the, we have the arguments kind of in mind. We've got a collection of visible lines and an integer of the first visible.
Joe Tannenbaum
Meaning what's the-
Aaron Francis
So I don't know if I fully understand.
Joe Tannenbaum
So let's say, let's just say we have a collection of 100 items.
Aaron Francis
Yep.
Joe Tannenbaum
Uh, we are showing 20, so that collection-
Aaron Francis
Yep
Joe Tannenbaum
... of visible is gonna be 20 items.
Aaron Francis
Uh-huh.
Joe Tannenbaum
And we are saying we are at the 40th item. We're at index 40 of this collection. And all that, all that's doing is showing... Because she has to draw a scroll bar, right? So this is all completely manual.
Aaron Francis
Oh. Oh, oh, oh, oh.
Joe Tannenbaum
So it's saying, okay, how far down this list are you? And then give us the total height of the area that we're working with, and that means that we can shraw, we can draw the scroll ball, gar-
Aaron Francis
You got it. You got it.
Joe Tannenbaum
Draw the scroll bar-
Aaron Francis
Power through.
Joe Tannenbaum
... appropriate height.
Aaron Francis
Okay.
Joe Tannenbaum
And then, uh, the total total of items. So like how many items are in the actual collection. R- she's basically just calculating percentages here off of like what you're showing, right?
Aaron Francis
Got it. Okay. And this is for scroll bar only. Got it. Okay.
Joe Tannenbaum
No, no, no. This is gonna show a scrollable list.
Aaron Francis
Ooh.
Joe Tannenbaum
So like you'll be able to scroll this list. Here, here's the difference. So in a browser, we get this for free, right? Like we are sh-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... we, we can just put a bunch of stuff on the page, and the, the browser will figure out this out for us.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
In the terminal, it's a virtual scroll.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
We don't render things that are outside the area. We're only rendering-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... what's inside the area, so it's like a scrolling list of this 20, these 20 items, right?
Aaron Francis
Mm-hmm. Mm-hmm. Mm-hmm.
Joe Tannenbaum
So, um, super manual, but this is like probably the best abstraction I've ever seen of this, where it's like as minimal information as you can give and get this back.
Aaron Francis
Okay. All right. Let's try it.
Joe Tannenbaum
Okay. So, um-
Aaron Francis
So we have draws scroll bar as a trait, so I imagine like somewhere down here, are we gonna do this scroll bar or something?
Joe Tannenbaum
Correct. That's right.
Aaron Francis
Okay.
Joe Tannenbaum
Okay.
Aaron Francis
Um, so let's... Probably not gonna each out our lines anymore.
Joe Tannenbaum
Beautiful.
Aaron Francis
Or at least not yet.
Joe Tannenbaum
We're actually gonna set that to a variable, I would say-
Aaron Francis
Okay
Joe Tannenbaum
... that all, everything we just did there.
Aaron Francis
All right. So we'll call this, I'm gonna call this visible. Does that seem right?
Joe Tannenbaum
That seems correct.
Aaron Francis
Okay.
Joe Tannenbaum
So we're gonna do this the way we have it now, and then we'll adjust for-
Aaron Francis
I love that
Joe Tannenbaum
... other things later. We'll just do it this way now.
Aaron Francis
Incremental progress. I love that.
Joe Tannenbaum
Yeah, yeah, yeah.
Aaron Francis
So visible first visible. So visible, then what is-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... first visible gonna be here?
Joe Tannenbaum
So we need to know what index we are on currently, which means that right now... Okay. Eh. I was, like, trying to keep this simple, and I was like, there's kind of no way. We need to add a little bit of, um, state to your gathers. What is it called? Gathers output?
Aaron Francis
Gathers output.
Joe Tannenbaum
Okay. 'Cause is this a generic gathers output for everything that's happening here?
Aaron Francis
For any output, yeah.
Joe Tannenbaum
Perfect.
Aaron Francis
So riddle me this.
Joe Tannenbaum
But they're all individual-
Aaron Francis
Is there something we can, is there something we can just hard code here?
Joe Tannenbaum
Yes.
Aaron Francis
Just like one, two, three, four, five, and run it?
Joe Tannenbaum
Uh, uh, let's do, let's do 20. Let's just put 20 in, and we'll see what, what comes out of that. So we're on the 20th-
Aaron Francis
Okay
Joe Tannenbaum
... index, let's just say. Uh-
Aaron Francis
Height is required.
Joe Tannenbaum
The height.
Aaron Francis
And so-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... we have that. Allow... No, no, no. We have-
Joe Tannenbaum
Yep.
Aaron Francis
Ah.
Joe Tannenbaum
Allowed lines is good. That's good.
Aaron Francis
Okay.
Joe Tannenbaum
Yep. Uh, and then I think, what's next?
Aaron Francis
Total.
Joe Tannenbaum
Okay. So then we also have, we have that information already, so, um, go, go back to the other, to the other screen.
Aaron Francis
Oh, oh, oh, oh.
Joe Tannenbaum
So it's the-
Aaron Francis
So we need to-
Joe Tannenbaum
... it's the total of this here. This, these lines, that's the total we're looking for. How many lines-
Aaron Francis
Okay. So we need to do something else here. We need to not take that. We need to flat map that. We need to say that this is total lines after it's been flat mapped.
Joe Tannenbaum
Oh, yeah. We can totally do this.
Aaron Francis
Then we'll say-
Joe Tannenbaum
Yes
Aaron Francis
... visible equals total lines take, and then this is total lines count.
Joe Tannenbaum
Beautiful.
Aaron Francis
Does that seem right?
Joe Tannenbaum
Uh, yeah. And then we, I think we just need a width as the last one.
Aaron Francis
Width, okay, which we have. Okay, so we've written the scroll bar, but have we written the lines? Yes, I guess the scroll-
Joe Tannenbaum
No, it's a collection, I believe, that's returned, and then you each out that. If I remember correctly.
Aaron Francis
Oh. Returns collection-
Joe Tannenbaum
Yes
Aaron Francis
... and string, yep.
Joe Tannenbaum
Yep.
Aaron Francis
So then we'll just each this line. By the way, your course does this all the time, and that's not a pattern that I use very often, and I love it. It's great.
Joe Tannenbaum
You're about to use it a lot. It's amazing.
Aaron Francis
Yeah, it's really great.
Joe Tannenbaum
Yeah.
Aaron Francis
All right, so if we quit this.
Joe Tannenbaum
Oh, boy. Here we go.
Aaron Francis
And then we clear it.
Joe Tannenbaum
Yeah, how's it?
Aaron Francis
All right. So let's do no alt screen.
Joe Tannenbaum
Total, okay. Yeah, yeah, yeah, yeah, yeah. Uh-
Aaron Francis
Dashboard render pad
Joe Tannenbaum
Oh, interesting. Um, okay. Oh, it's probably expecting to use this with... It's never used-
Aaron Francis
Oh
Joe Tannenbaum
... by itself, so it's just missing a trait, which is, um, probably draws boxes. Uh, say-
Aaron Francis
Interacts with strings. That's feels pretty low level.
Joe Tannenbaum
Okay. Yep. That's fine.
Aaron Francis
Do we want that one?
Joe Tannenbaum
Yeah. We'll, we'll take it. So just add that to your main, to your main one.
Aaron Francis
Interacts with strings.
Joe Tannenbaum
I'm kind of surprised that's not in there for some reason. Oh.
Aaron Francis
Okay. All right. So let's do-
Joe Tannenbaum
And now-
Aaron Francis
... the with an alt screen. That-
Joe Tannenbaum
Okay. I don't see a s- oh, because-
Aaron Francis
... something
Joe Tannenbaum
... we don't see a scroll bar though. I don't see the actual... I see a bar-
Aaron Francis
Let's change-
Joe Tannenbaum
... but I don't see, like, the little-
Aaron Francis
Let's change this to, like, five. There you go. Right there.
Joe Tannenbaum
Oh, I can... Yep, there it is. Okay. Perfect.
Aaron Francis
Okay.
Joe Tannenbaum
Great. We just made a scroll bar. Now, to make this work, um, you need to track the scroll position on each of these-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... gathers outputs, right? So you need to know what, what index you're on. So basically, um, whatever you decide scrolls, so if you're doing up and down arrow keys, you just need to change that index, and then that'll slide the, the visible view as we, as we go. So that'll be your, like-
Aaron Francis
Oh, no way
Joe Tannenbaum
... first visible, right? So basically-
Aaron Francis
Okay. So let's do this then
Joe Tannenbaum
... um, on gathers output, just, just add a, add a piece of state.
Aaron Francis
Well, let's... Can we just test it-
Joe Tannenbaum
Oh, go do that
Aaron Francis
... real fast?
Joe Tannenbaum
Oh, sure. Yeah.
Aaron Francis
Um, so if we have... These are all of the lines mapped to the right size.
Joe Tannenbaum
Right. Instead of take, you're gonna want slice, I believe, or s- yeah, slice. You wanna take a, a slice of starting at the index we wanna be on and the number of allowed lines that we have.
Aaron Francis
Oh, I see. Okay.
Joe Tannenbaum
Make sense?
Aaron Francis
So we'll say, um, start equals zero, which-
Joe Tannenbaum
Nailed it. Yep
Aaron Francis
... is not right, but w- that'll be fine. And then we want slice, offset, and length. So we'll do slice from zero to-
Joe Tannenbaum
No.
Aaron Francis
Not, no
Joe Tannenbaum
Start to allowed lines.
Aaron Francis
Start and have as many allowed lines as you want. Um-
Joe Tannenbaum
And then change that five to start. And-
Aaron Francis
Okay. Now we're getting real.
Joe Tannenbaum
And then once we replace start with the state from your gathers output-
Aaron Francis
Mm-hmm, mm-hmm, mm-hmm
Joe Tannenbaum
... we'll have a proper, a proper thing going on here.
Aaron Francis
Okay, so that looks right to me in that the scroll bar's at the very top, and presumably, this is the first line that gathers output has collected. So now-
Joe Tannenbaum
Yes, presumably
Aaron Francis
... what if we did, um, what gets passed in here? A dashboard gets passed in here. So let's go to dashboard. Oh, I see. Uh, let's just do one global one for now.
Joe Tannenbaum
Sure.
Aaron Francis
And then we can do it on, uh, bit by bit. So this is probably on, we'll say on down. Does that seem right?
Joe Tannenbaum
Seems good. Yeah.
Aaron Francis
Um, this current command stop. We'll say this, um, doesn't matter. Uh, scroll-
Joe Tannenbaum
What is current command?
Aaron Francis
Uh, current command is-
Joe Tannenbaum
Oh, I see. Let's see
Aaron Francis
... the dev command. So we can put the state there.
Joe Tannenbaum
Yeah. Isn't that, that's where... Yeah.
Aaron Francis
That's where we want it-
Joe Tannenbaum
We could totally do that
Aaron Francis
... in fact.
Joe Tannenbaum
Yep. Yep. That's, that's correct.
Aaron Francis
So let's just do that, and we'll say current command scroll index, probably just plus or plus
Joe Tannenbaum
Well, why don't you just add a method that's called scroll down, and then we can just deal with it in there, um-
Aaron Francis
Ah, you old dog. I like that. Current command, dev command. Um, public function scroll down. Uh, we'll make it a little bit more intelligent in a second, and we'll say-
Joe Tannenbaum
Yeah
Aaron Francis
... um, let's just say bind protected.
Joe Tannenbaum
Public.
Aaron Francis
It should be on Control + N. That's interesting. Um, I don't know what Control + N is. Public integer scroll, and see, all this terminal stuff, we'll just start it at zero. It should, in reality, be the last line, 'cause we want it pinned to the bottom, but that's fine.
Joe Tannenbaum
Oh, sure, yeah.
Aaron Francis
We'll say this, uh, scroll. Control + N for down and P for up. That's so interesting. I've never heard of that in my life. Scroll index actually needs to go, if we're scrolling down-
Joe Tannenbaum
Go up
Aaron Francis
... the index needs to go up. Is that right?
Joe Tannenbaum
Yeah. That's correct.
Aaron Francis
And we'll add some safeguards here in a minute.
Joe Tannenbaum
Yep.
Aaron Francis
Um, okay. So then back in dashboard, we want this command scroll on down is scroll down, and on... These little affordances are super nice. Are these you or Jess?
Joe Tannenbaum
I, uh, this is me. Yeah.
Aaron Francis
That's awesome.
Joe Tannenbaum
You can, you can register key presses the way that, um, Promps does, but the fluidity of this and the s- it, it just feels so much better. It's just more-
Aaron Francis
Yeah
Joe Tannenbaum
... fluid.
Aaron Francis
Yeah. I like this a lot.
Joe Tannenbaum
I mean, she didn't, this isn't really what it's for. I am, like, really hijacking this thing. So it's-
Aaron Francis
Of course
Joe Tannenbaum
... you know, she shouldn't have thought about this stuff.
Aaron Francis
Of course. Um, okay. So then we can now go to the renderer and check the prompt. And so instead of start, we'll say prompt scroll index.
Joe Tannenbaum
Uh, prompt commands. I, I don't know-
Aaron Francis
Oh
Joe Tannenbaum
... how you access that.
Aaron Francis
Oh, oh, oh, oh.
Joe Tannenbaum
I think-
Aaron Francis
Um, where does-
Joe Tannenbaum
If you go up a little bit, I think it's that
Aaron Francis
... this one.
Joe Tannenbaum
Yeah, yeah.
Aaron Francis
That could be made, that could be made nicer. Um, but who has the time?
Joe Tannenbaum
Nobody has the time. Uh, and yeah, scroll index.
Aaron Francis
So again, it's just selected scroll index.
Joe Tannenbaum
And I think we might have a scrollable window now. Let's see.
Aaron Francis
Hey, we've got a scrollable-
Joe Tannenbaum
It's working
Aaron Francis
... window. Look at that. And we got some errors. Who cares?
Joe Tannenbaum
So we don't have the safeguards, so it sort of like gets-
Aaron Francis
Yes
Joe Tannenbaum
... it gets wild in there, but, uh, yeah.
Aaron Francis
So if we go over to... That's just, that's just not running. Um, none of these are actually running, so that's, we don't have any. Look at that. We have a scrollable-
Joe Tannenbaum
So if you, if you end up clamping it, if you make sure that the scroll index doesn't go past the allowed values, then you're, you're in, you're in the money. You're good to go.
Aaron Francis
Uh, scroll index equals, so this'll be fun. Um, equals max min.
Joe Tannenbaum
So I actually just added... Are you in the, um, are you in the latest version of, of Promp- of, uh, Chewy?
Aaron Francis
1.7?
Joe Tannenbaum
Couldn't tell you. Uh, let's see if you have it. Um, I, I have this new utility because I've been doing it so much. Yes. Okay, cool, and you'll be the first to use it probably. Um-
Aaron Francis
Oh, yeah
Joe Tannenbaum
... it's called-
Aaron Francis
1.7
Joe Tannenbaum
... I believe clamped number. So you can, um-
Aaron Francis
Uh, who? Who has clamped number? Or does that-
Joe Tannenbaum
You know what? Let's just do it the manual. We'll do it this way. This is too-
Aaron Francis
Okay
Joe Tannenbaum
... this is too much. So you want to-
Aaron Francis
Is it-
Joe Tannenbaum
Yep, you got it. Nailed it.
Aaron Francis
Do I?
Joe Tannenbaum
Yeah.
Aaron Francis
Um, the max of-
Joe Tannenbaum
So it's the minimum. It's the minimum
Aaron Francis
... the minimum of this. And-
Joe Tannenbaum
Uh-huh
Aaron Francis
... oh, I don't have, I don't have-
Joe Tannenbaum
I mean, you can-
Aaron Francis
... the mapped lines
Joe Tannenbaum
... oh, you can, yeah.
Aaron Francis
We might, 'cause-
Joe Tannenbaum
We do have to move them there
Aaron Francis
... I didn't flat map them. We, we have to move it into that other spot, don't we?
Joe Tannenbaum
Yeah. But you're gonna need them for all of it, so when you initialize... Yeah. The, all these dev commands need to know what the width is, unfortunately. It's kind of the nature of the beast sometimes that, uh, unless, unless you do this logic in the renderer, so you have to choose your, you have to pick your poison here.
You either have to, uh, make sure-
Aaron Francis
Hmm
Joe Tannenbaum
... the scroll index is not past that in the renderer, or you need to do it here, and either is fine. But, um, you get weirder side effects when you calculate it in the renderer because you could, you'll always be increasing the scroll index, so you might-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... like if you went past it, then you would get like this weird delay going back up because it's like decreasing until it's like caught up to where it actually should be. Yeah, you hate it.
Aaron Francis
I see.
Joe Tannenbaum
I hate it too, but it is a little bit the nature of this particular beast.
Aaron Francis
Yeah, this is a very, um, this is an environment that I'm not used to being in.
Joe Tannenbaum
Yeah.
Aaron Francis
Like all this, all this manual stuff. Um, yeah. Somebody said we could just pass max in for now. Let's just do that for now.
Joe Tannenbaum
That's fine. That, that works.
Aaron Francis
Does that feel okay? There's, there's some, there's some refactoring to be done.
Joe Tannenbaum
Well, how do we know, how do we know the max, though? We have to know, we still have to know the flat mapped max, right? We have to know the word wrap max on this thing. 'Cause the, the scroll down happens in the key binding-
Aaron Francis
Oh, it happens in the-
Joe Tannenbaum
... which is in the states
Aaron Francis
... freaking other place. Yeah.
Joe Tannenbaum
Yeah, yeah, yeah. Now-
Aaron Francis
All right. Let's move it to-
Joe Tannenbaum
Yeah, it just gets wild. I was gonna say, you could pass it back from the renderer to the thing, but that just feels bad. That feels bad in a different way
Aaron Francis
All right, so we're gonna move it over here. Um-
Joe Tannenbaum
Here, here's how I typically do this. I like to have a pure, like, lines, meaning like these are the original lines, so if they resize the terminal or something like that-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... or I, I need adjustments, I still have the original to work with. But then I have-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... sort of like a word wrap lines array as well, so that, like, every time we're adding lines, we're adding it to the original, and we're adding it to the word wrap so that, like, the original stays pure, and we can, like, work off of it if we need to for some reason. I-
Aaron Francis
Okay
Joe Tannenbaum
... am probably over-optimizing right now for this particular project, but I'm just sort of checking that out there.
Aaron Francis
Um, would it be too expensive to just have a... I just don't, I just don't have a good sense of how fast all of this stuff is. So would it be too expensive to do this?
Joe Tannenbaum
No, it should be fine. That's cool. Yep.
Aaron Francis
I feel like this stuff-
Joe Tannenbaum
Uh-
Aaron Francis
... is pretty quick, right?
Joe Tannenbaum
Right. But again, like, how are you going to...
Aaron Francis
I need the width, eh?
Joe Tannenbaum
Yeah, the width is really the thing.
Aaron Francis
That's fine. I'll just, we'll just start here.
Joe Tannenbaum
Yeah.
Aaron Francis
Make it work, make it pretty.
Joe Tannenbaum
This is the easiest way r- for now.
Aaron Francis
All right. So we can get rid of you, and then we'll say that you come here. And since we just have one, we'll put it up there. Um, this is...
So then we can come back here, kill you for a second. Dashboard renderer. Who are you? So we need gathers output to receive the width, but that happens in here.
Joe Tannenbaum
Oh, boy.
Aaron Francis
Oh, boy.
Joe Tannenbaum
Wait, and is that happening in the original command?
Aaron Francis
Yeah, that happens out in user land.
Joe Tannenbaum
Um-
Aaron Francis
So what we're gonna have to have is-
Joe Tannenbaum
Okay. Well, here's-
Aaron Francis
... a set width. Go on.
Joe Tannenbaum
Yep. You, you already did it.
Aaron Francis
Okay.
Joe Tannenbaum
You got it. Yep.
Aaron Francis
Okay. Sorry. And... Which might be good, 'cause we might need to reset it anyway if somebody resizes.
Joe Tannenbaum
Yeah, yeah, yeah.
Aaron Francis
I guess this doesn't need to be public. I don't really, I just don't really care. It's not a Boolean either. I don't really care about public/private that much. Do you? It's just not something that-
Joe Tannenbaum
I don't except-
Aaron Francis
... has ever concerned me
Joe Tannenbaum
... except in this stuff, um-
Aaron Francis
Ah, shoot. Dang it
Joe Tannenbaum
... I, I've, I've never, I've never had more public... No, no, you're, you're right in this. Like, this is fine. You don't need this public. But, um, I've never had more public properties on any class ever than since I've started working with this stuff because, I don't know, I just make everything protected. It's all-
Aaron Francis
Yep
Joe Tannenbaum
... it's all protected all the way down. Um-
Aaron Francis
Um-
Joe Tannenbaum
Okay, so here's what, uh, we're in the dashboard-
Aaron Francis
Can we do each run-
Joe Tannenbaum
So-
Aaron Francis
We start each one. We also need to-
Joe Tannenbaum
So I would set a prob- public width property on this so that everybody's on the same page and we're not calculating it twice in the-
Aaron Francis
Oh, that's smart.
Joe Tannenbaum
Um, yeah. So public width property, set it to what you're setting it in the render right now, uh, which you already have somewhere in there. Boopity bop. Yep. Grab that. Set that property. Now everybody's-
Aaron Francis
'Cause this is prop
Joe Tannenbaum
... working off the same width-
Aaron Francis
Okay
Joe Tannenbaum
... all the time. Yes, exactly.
Aaron Francis
Cool, cool, cool, cool, cool. I like it. Width-
Joe Tannenbaum
Yeah
Aaron Francis
... equals this terminal-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... less two. And then-
Joe Tannenbaum
Uh, just set the property instead of a local variable.
Aaron Francis
Yep.
Joe Tannenbaum
Yep, yep. And now we can pass that along to whatever, and now the renderer can also use that too, so everybody's on the same page.
Aaron Francis
So, I mean, we could probably do set. What are... These are the commands. These are the commands, and I need, I need to go through the command to the component, I think. The command has a component. Goodness me.
Joe Tannenbaum
Oh my goodness.
Aaron Francis
Um, okay. So we need to go through the command to the component. So let's just do it like this for a second. Let's just pull all of this in here. We'll say that this is a dev command, command. We'll say command run, and then does run return this? Yep.
Joe Tannenbaum
Uh-huh.
Aaron Francis
Then, um-
Joe Tannenbaum
Set width here?
Aaron Francis
Command component.
Joe Tannenbaum
Oh.
Aaron Francis
Not w-width, width. Boy, architecting this stuff is... I'm having, I'm having trouble keeping track of this. Um, set width-
Joe Tannenbaum
Yeah
Aaron Francis
... is this width. I feel like, um, despite it being, like, nice and organized in different classes, everyone has to know everything about everyone else. So it's like, what are, what are we doing here, you know?
Joe Tannenbaum
When you're doing something simple, it's pretty straightforward. As soon as, basically, as soon as scroll bars get in the mix, it starts, like everybody needs to know a lot of things. Which is-
Aaron Francis
That's why, that's why you're here, because I looked at scroll bars-
Joe Tannenbaum
Yeah
Aaron Francis
... and was like, "I can't do that." Um, okay. So now upon booting the dashboard, um, the prompt dashboard, we set the width-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... and then we loop through the commands that have been registered, which could be user land, um, and we start each actual underlying command. And so-
Joe Tannenbaum
Right
Aaron Francis
... this, this does the whole pending process thing and starts it, and then we reach into the gathers component of each command-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... and we set the width. So now we are safely here. Um...
Joe Tannenbaum
Okay. So-
Aaron Francis
That's fine
Joe Tannenbaum
... we need to make sure that the renderer is now accessing this width instead of width, 'cause that's no longer available. That's 'Cause that's gonna break everything immediately
Aaron Francis
Okay, so we need to go to the dashboard renderer
Joe Tannenbaum
And wherever we wrap the thing-
Aaron Francis
For now-
Joe Tannenbaum
Oh yeah, perfect. Yep
Aaron Francis
... for now I'm just gonna do this, prompt-
Joe Tannenbaum
That's correct
Aaron Francis
... with.
Joe Tannenbaum
Yep. Perfect.
Aaron Francis
A little, a little goofy, but that's fine. Um, okay, so then down here, total lines becomes prompt... What did we call it? Wrapped lines.
Joe Tannenbaum
Wrapped lines, but it's not the prompt, it's this-
Aaron Francis
Nope
Joe Tannenbaum
... uh, commands thingy.
Aaron Francis
Mother. God freaking.
Joe Tannenbaum
Shit.
Aaron Francis
Um, okay, so we're gonna do this. We are gonna... We can do this as early as we want, right? Selected command is over here, and prompt commands. I think we can do this as early as we want.
So we're just gonna say that selected-
Joe Tannenbaum
Yeah
Aaron Francis
... equals that. Eh, we'll move that around later. Um, so then presumably we can say total lines equals selected command, which is goofy 'cause this is named selected command and they're entirely separate things. Um, selected command component.
Blah.
Joe Tannenbaum
Oh, man. Oh, man.
Aaron Francis
So gross. Um-
Joe Tannenbaum
And then wrapped lines. Oh, boy.
Aaron Francis
Gotta make it work. Just gotta make it work. Um-
Joe Tannenbaum
Uh, and then you want the, you want the count on that. You want the count on that 'cause it's total lines.
Aaron Francis
Do I?
Joe Tannenbaum
Yes.
Aaron Francis
No, I do not.
Joe Tannenbaum
Oh, sorry. Total lines count is below. My bad. My bad.
Aaron Francis
Yeah, let's do this.
Joe Tannenbaum
Yep.
Aaron Francis
Wrapped lines is wrapped lines, wrapped lines slice, wrapped lines count. So what have we done? Have we done anything? Catch me up.
Joe Tannenbaum
Uh, we clamped-
Aaron Francis
Where are, where, where are we?
Joe Tannenbaum
I think... Oh, we need to clamp the values.
Aaron Francis
Oh, we haven't clamped. We haven't clamped.
Joe Tannenbaum
We have to clamp. That was the whole thing. I totally clamped the values.
Aaron Francis
That was the whole freaking thing. Um, so we need to go to... What are you complaining about? Yeah, yeah. Hey. Perfect. Perfect.
Joe Tannenbaum
Okay, so now we know some things.
Aaron Francis
We do. What do we know? Um, so we need the min of, uh-
Joe Tannenbaum
This wrapped lines count.
Aaron Francis
Is it this? No, it's this component.
Joe Tannenbaum
Oh, component.
Aaron Francis
Which is goofily named, doesn't mean anything.
Joe Tannenbaum
Yeah.
Aaron Francis
Component could be anything. Okay, so let's just say max lines equals that. So we want the min of... Yeah, the min of one more-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... or however many lines there are.
Joe Tannenbaum
I think minus one, I believe, is what we want because it's, uh, we're doing a count, so I believe minus one. 'Cause the m- the, the last index will be one less than the count of the... Yep.
Aaron Francis
I think you're right. So actually this-
Joe Tannenbaum
Uh, this we don't need max lines for.
Aaron Francis
Yeah.
Joe Tannenbaum
We just need zero, and it would be minus one. Perfect. And now we might, we might have something.
Aaron Francis
Might we? There's like a 4% chance we got all this right. Um, okay, so we are back. Goodness, I need to name these things better. Um, we're back over here. Current command, scroll down.
Joe Tannenbaum
It's so clean. I love that. Love that.
Aaron Francis
Yeah. This is great. This is great. Why am I not just using current command over in the renderer?
Joe Tannenbaum
Nobody knows.
Aaron Francis
That's exactly this. Nobody knows.
Joe Tannenbaum
Mm-hmm. Yeah.
Aaron Francis
Least of all me. Um-
Joe Tannenbaum
We're all asking.
Aaron Francis
Yeah. Yeah. We sure are. Um, okay. Okay, so we're scrolling-
Joe Tannenbaum
Now you should stick to the bottom
Aaron Francis
... down, down, down.
Joe Tannenbaum
Oh.
Aaron Francis
And we don't.
Joe Tannenbaum
Okay, what did we not calculate correctly here? Oh, sorry. Okay. Let's go back. Yes, this is the last piece of the puzzle.
Aaron Francis
Okay.
Joe Tannenbaum
Um, we can't scroll all the way to the last index because we need to leave the, the number we're taking on the screen. So I know, this is all so-
Aaron Francis
Yeah
Joe Tannenbaum
... manual. Yes. It's okay. It's okay. We can totally do this. Uh, so where... Go to the renderer. And how many are we... Where are we setting this? Oh, allowed lines is height minus six. So I got, I have some slightly bad news for you.
Aaron Francis
Okay, perfect.
Joe Tannenbaum
Uh, this should probably be stored on the... Wait, do we need to-
Aaron Francis
No, don't do this. Don't do this to me.
Joe Tannenbaum
Oh. Okay, the, the, the quick fix-
Aaron Francis
I see what you're saying.
Joe Tannenbaum
Um, yeah. The quick fix is that we can do this in the renderer, but long term, that's not great because of the same problem we had before.
Aaron Francis
Shoot.
Joe Tannenbaum
The official way of doing this would be to pa- pass the height along and store how many are supposed to be visible at any given moment on the gathered output.
Aaron Francis
All right, we just did it, so it's fresh. Let's just power through. Um-
Joe Tannenbaum
Yeah, so we basically just need to replicate that. Yep. Man, oh, man.
Aaron Francis
No, we're doing this. Set dimensions.
Joe Tannenbaum
Oh, baby.
Aaron Francis
What do you, what do you think about that, huh?
Joe Tannenbaum
I love that.
Aaron Francis
Isn't that wild?
Joe Tannenbaum
I love that. Yeah.
Aaron Francis
Yep, yep, yep, yep, yep. Um, so then we come back to who? You probably? Each-
Joe Tannenbaum
Yeah. So let's get a height property on this as well.
Aaron Francis
So we'll come back to the renderer, and we are just gonna yoink that, and we'll just replace it with that for now, which is silly, but that's fine. Um, and so we just... Good Lord. Um, we're just putting stuff everywhere, aren't we? And setDimensions now accepts a width and a height, and we need to say that this height...
Dewey Pager sounds like a package on its own. Yeah, Joe, can you just do that and get back to me?
Joe Tannenbaum
Yeah, I can.
Aaron Francis
Yeah. Thank you.
Joe Tannenbaum
It's like I could build 100 of these things, but, like, who want... I don't know.
Aaron Francis
You should.
Joe Tannenbaum
Who actually wants them? There's like, you know, I-
Aaron Francis
Me, for right now.
Joe Tannenbaum
That's true.
Aaron Francis
Yeah.
Joe Tannenbaum
Yeah. That's true.
Aaron Francis
Don't you... It's not like it's just, you know, Taylor's not watching. You should just-
Joe Tannenbaum
Well-
Aaron Francis
... do this on company time.
Joe Tannenbaum
What else am I doing? I am doing this on company time.
Aaron Francis
Oh, perfect. Even Steven, what's the problem? Um-
Joe Tannenbaum
Yeah
Aaron Francis
... okay, setDimensions, width, height, width, height. Um, okay. So then-
Joe Tannenbaum
Okay
Aaron Francis
... probably over in the dev command.
Joe Tannenbaum
Yeah. So-
Aaron Francis
We need to do something-
Joe Tannenbaum
We should... Aye, aye, aye, aye, aye. Um, we should specify somewhere in here a property that says what the visible window, what's the count of the visible window, so that we can use that in the renderer, okay? So basically, um-
Aaron Francis
All right, let's hard code for now
Joe Tannenbaum
... make a property... Yeah. It's fine. Um-
Aaron Francis
So we'll say this component, we do have height, right?
Joe Tannenbaum
And right now we're setting it to height minus six, if I remember correctly.
Aaron Francis
Man, whatever.
Joe Tannenbaum
I know, it feels, feels bad. It all feels bad.
Aaron Francis
It all feels bad. Um, we are setting it to... So in the-
Joe Tannenbaum
Wait, why is this, uh-
Aaron Francis
All right, so in the dashboard prompt, we're setting it to-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... terminal lines less three.
Joe Tannenbaum
But go down to allowed.
Aaron Francis
Um-
Joe Tannenbaum
I think we called it allowed lines
Aaron Francis
... F me. Yeah. Mother, um-
Joe Tannenbaum
Yep, height minus six
Aaron Francis
... so then... All right, let's just hard code that for a second.
Joe Tannenbaum
It's fine. Um-
Aaron Francis
So this component height already has the less three, it just needs the less six. Um-
Joe Tannenbaum
Mm-hmm. Yep.
Aaron Francis
This is like, more like pane height, right?
Joe Tannenbaum
Sure. Yeah. Well, it's like it's the... Yeah. That's, that... Exactly right, actually. Yeah.
Aaron Francis
Okay.
Joe Tannenbaum
That's fine. Um, okay. So now when we add, we wanna go, uh, max lines minus one, minus scroll pane height, I think is what I wanna do.
Aaron Francis
No, I can't be right.
Joe Tannenbaum
Give me a minute.
Aaron Francis
It's gotta be like-
Joe Tannenbaum
Well, because-
Aaron Francis
... scroll pane height less one, right?
Joe Tannenbaum
So if you have 100, and the pane height-
Aaron Francis
Oh
Joe Tannenbaum
... is say 20, you can only go up to actually 80, right? So your fir- because we're talking about, let me just be clear, we're talking about the first visible index that's, that's being shown here, right?
Aaron Francis
No, I think you're right.
Joe Tannenbaum
It'll, it'll either be immediately evidently wrong or immediately evidently right. And we'll, we'll adjust from there.
Aaron Francis
Well, it's great. Okay. So this will only... So we need to get in there and scroll down. In fact, what we need to do is we need to go to Laravel.log. Yeah. We need to clear all of that out, and then-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... we need to have a little bit better understanding-
Joe Tannenbaum
Need some insight
Aaron Francis
... of what's happening. Yeah. So this will be a little bit better. So now if I take you, that should be correct. Okay.
Joe Tannenbaum
Okay.
Aaron Francis
This should be a little bit easier to understand.
Joe Tannenbaum
Correct. Good job.
Aaron Francis
Okay.
Joe Tannenbaum
Okay. So already it looks too short.
Aaron Francis
Already looks-
Joe Tannenbaum
That's-
Aaron Francis
... weird
Joe Tannenbaum
... weird. Also-
Aaron Francis
We also have no scroll bar.
Joe Tannenbaum
Oh, are we limiting the amount of logs coming in?
Aaron Francis
Maybe.
Joe Tannenbaum
What's the command you're running?
Aaron Francis
Maybe. Maybe, maybe, maybe. Okay. That's close. That was close. Um-
Joe Tannenbaum
'Cause it goes, it reverts to no scroll bar if the-
Aaron Francis
What do I need? Like dash N something?
Joe Tannenbaum
Yeah, dash N, and let's just say 100, just to like give us, give us some breathing room. Yeah.
Aaron Francis
Can I do it there?
Joe Tannenbaum
Mm-hmm.
Aaron Francis
Or does it have to be... There we go.
Joe Tannenbaum
Yeah. Okay.
Aaron Francis
There we go. Okay. Good so far.
Joe Tannenbaum
Yeah.
Aaron Francis
Boy, that's a lot easier to track, isn't it?
Joe Tannenbaum
Oh, way easier. Oh, it's looking good.
Aaron Francis
Okay. So then we get-
Joe Tannenbaum
It's looking good. It's looking good
Aaron Francis
... close to the bottom. We stopped a little... Well, the, um-
Joe Tannenbaum
Hmm. It should be at the end. It should be at the end
Aaron Francis
... in my opinion, the scroll bar is in the wrong position, but the lines-
Joe Tannenbaum
But it means we-
Aaron Francis
... are in the right position
Joe Tannenbaum
... are probably doing something wrong, I would say.
Aaron Francis
Yeah.
Joe Tannenbaum
So-
Aaron Francis
Yeah. It's definitely me, not Jess. That's for- ... that's for dang sure. I can guarantee you that one.
Joe Tannenbaum
Um, okay, let's-
Aaron Francis
Oxyzone, I am reading YouTube chats as well. Yes, I'm reading all chats. Um, okay.
Joe Tannenbaum
What, uh... Let's go back to the scroll bar method to make sure we're passing all the right params still.
Aaron Francis
Um, where?
Joe Tannenbaum
Yeah. We have lines count. That's cor- Okay. So we have the visible, which is fine. The start, which is the scroll index. The allowed lines. Hmm. Maybe we don't need the... Maybe the minus one is messing us up, although it shouldn't be, but maybe it is.
Maybe the minus one needs to be differentiated.
Aaron Francis
That's my, that's my favorite fix is like, did the minus one need to be there? We don't know
Joe Tannenbaum
I don't know, let's see.
Aaron Francis
We're gonna find out.
Joe Tannenbaum
Let's see if it breaks.
Aaron Francis
I always do a minus one, plus one, see what happens. Um...
Joe Tannenbaum
There we go. Now we are sort of-- We are-- Now we're getting a little space at the bottom, which is weird, so-
Aaron Francis
Doing a little overscroll.
Joe Tannenbaum
Hmm. Some- something's funny here. I'm not really sure-
Aaron Francis
But this, this is, this is fine-tunable later.
Joe Tannenbaum
Yeah. But we have a scrolling bar, which is cool.
Aaron Francis
This is very cool. Um...
Joe Tannenbaum
Oh.
Aaron Francis
Allow-
Joe Tannenbaum
Uh, are we getting... No, we shouldn't. No. No. No. I was thinking, do we have, like, an extra space at the end of the log? Is there a space at the end of the log? Do you have a-
Aaron Francis
Let's check
Joe Tannenbaum
... do you have automatically adding a space, or is there no space?
Aaron Francis
Hey, it's not our fault.
Joe Tannenbaum
It's not our fault.
Aaron Francis
It's not our fault.
Joe Tannenbaum
No, this is correct. This is the correct output.
Aaron Francis
Well, I mean, it's mostly, it's mostly my fault. Yeah. Why do you, why are you doing that?
Joe Tannenbaum
It just auto-adds a space 'cause that's an editor thing.
Aaron Francis
Oh. PHP Storm, huh?
Joe Tannenbaum
Um, so that's correct. That's good. We did it.
Aaron Francis
We did it.
Joe Tannenbaum
Yep.
Aaron Francis
Oh.
Joe Tannenbaum
Oh.
Aaron Francis
Did we just loop around?
Joe Tannenbaum
Uh, oh, you're probably not-
Aaron Francis
Uh-oh
Joe Tannenbaum
... testing for uniqueness as you tail. Oh, 'cause you were... Okay. Let's see. No, I'm just thinking-
Aaron Francis
Is that a command thing? Let's restart it.
Joe Tannenbaum
Yeah.
Aaron Francis
Um-
Joe Tannenbaum
So, so basically something changed a couple of times, and you are just still piping it straight through into... It's not what would normally happen in a real log. You did something, like, weird, where you re-saved a file several times, and so tail just kind of piped in the existing log back to you. Normally, you would just get the new entries and you would probably be okay.
But you should-
Aaron Francis
Got it
Joe Tannenbaum
... check that. That seems-
Aaron Francis
Check, check that later
Joe Tannenbaum
... something's funny there. That's later. That's later.
Aaron Francis
Something's funny.
Joe Tannenbaum
Yeah.
Aaron Francis
Um, that's not the first weird thing I've done on this project, that's for sure. Um, okay. Let's do... How much more time do you have? Any?
Joe Tannenbaum
Uh, I probably have, like, 10 more minutes, and then I'm, uh-
Aaron Francis
All right
Joe Tannenbaum
... I'm probably gonna bounce.
Aaron Francis
Let's do, uh, let's do a little bit of... Well, you tell me. So, w- I have a few options here. We could do a little bit of cleanup, um-
Joe Tannenbaum
Yeah
Aaron Francis
... which isn't terribly sexy. We could do a, um, like a, like a pause and resume kind of thing. So here's, here's the use case that I'm thinking of. Um, if, if I'm, like, developing and something goes wrong, I wanna come and look at the logs, but they might have scrolled off the screen by then, of course.
Joe Tannenbaum
Mm-hmm. Mm-hmm.
Aaron Francis
So this is good, but I basically want, when I scroll up, um, I want it to... I don't know, like, I don't know how to handle the logs continually appending and keeping my scroll position, and then being like-
Joe Tannenbaum
Yeah
Aaron Francis
... "Okay, I'm done scrolling. Let's, like, jump to the bottom."
Joe Tannenbaum
It, it-- Yeah, that's a tricky one. I mean, um, you basically have to say, like, is the scroll index currently at the end-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... while, when a new log comes in.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
And if it is, make the sc- like, adjust the scroll index to be the new end scroll index to account for the new logs. So you could just up- update that state automatically as logs come in.
Aaron Francis
Oh.
Joe Tannenbaum
But if it's already not at the end, we assume you're scrolling-
Aaron Francis
Uh-huh
Joe Tannenbaum
... and keep it where it's at and let it, let it come back. And then you could always have, like, a little shortcut that says, like, "Jump me to the..." Like, live, live stream it or whatever, which basically, like, resumes the... And it, and it basically would update the scroll index to your last one, so that when the next logs come in, we assume we're auto-scrolling and it'll just start popping in. Does that make sense?
Aaron Francis
Uh-huh. Uh-huh. Uh-huh. Boy-
Joe Tannenbaum
Is that anything?
Aaron Francis
That's not a 10 minute, that's not a 10 minuter.
Joe Tannenbaum
Uh, no, but we can, we can talk about, like, the approach to what it would mean to pause, if you wanted to, like, pause it coming in. Is that... Or you just wanna do, like, an auto-scroll, not auto-scroll situation. That's really what you mean when you... When you say pause, you're not saying pause them coming in. You're saying pause-
Aaron Francis
Pause my view-
Joe Tannenbaum
... tailing
Aaron Francis
... of what's coming in, I think.
Joe Tannenbaum
Okay. So, um...
Aaron Francis
So let's do this. Let's do, real quick, um-
Joe Tannenbaum
So we could, we could make it, we could, we could do this. We could do this, I think. We could get-
Aaron Francis
Let's make sure
Joe Tannenbaum
... we could get, we could make some headway.
Aaron Francis
Let's make sure. I'm gonna open this test command and make sure I don't have any keys hanging around. I do not. So you can see how smart I am. I, uh, sometimes will just test things here, 'cause I don't really understand-
Joe Tannenbaum
Mm-hmm. Mm-hmm
Aaron Francis
... some behaviors. Very normal.
Joe Tannenbaum
Mm-hmm. Yep. Yep.
Aaron Francis
Um, okay. So let's say, uh, while true, info i++, i equals, who knows, we'll start at 40. Um, sleep for one. Okay. That's gonna log it, right?
Joe Tannenbaum
Yeah. So here we could just right out the gate make this auto-scroll very easily.
Aaron Francis
Okay.
Joe Tannenbaum
So if we go back to our-
Aaron Francis
I'm gonna start this command.
Joe Tannenbaum
Or... Okay. If we go to our-
Aaron Francis
And if we run that-
Joe Tannenbaum
I wanna say it's the gathers input. Oh, are we getting... That's true, that's gonna do.
Aaron Francis
We should see... Cool.
Joe Tannenbaum
Yeah. Perfect.
Aaron Francis
Okay. So it's wonky, but it's working. Okay.
Joe Tannenbaum
Okay.
Aaron Francis
All right.
Joe Tannenbaum
Uh-
Aaron Francis
You want it to be here?
Joe Tannenbaum
I think so. Is this where... Yeah. Yeah, yeah, yeah, yeah. Is this where the scroll index lives?
Aaron Francis
I think the scroll index lives on this one.
Joe Tannenbaum
Mm-hmm. You've already made this harder. Why? Why? Okay. Yeah. You, so-
Aaron Francis
Well, I didn't, I didn't... That wasn't me. You did it.
Joe Tannenbaum
Here's, here's, here's my thought on this, which is that-
Aaron Francis
Okay
Joe Tannenbaum
... um, where, where do we append the new lines in gathers output? Can you go to that method?
Aaron Francis
Uh-huh.
Joe Tannenbaum
Okay. So, mm-hmm, where's output? Lines, erase slice. So right here, here's what we need to do. We need to check based on the current wrapped lines, are we on the, are we at the last scroll index we could possibly be at? Are we at the max?
Aaron Francis
Mm-hmm.
Joe Tannenbaum
If we are, that means we can assume that we are auto-scrolling. Okay. So basically, like, we just need auto scroll equals some sort of Boolean, right? Oh, God. I'm, I'm killing you right now, I can feel it.
Aaron Francis
No.
Joe Tannenbaum
Uh, so let's just say true. Uh, we do some sort of check here that says, like, are we auto-scrolling at this point, right? Then we append the lines, and then we would say, if auto scroll, uh... Oy yoy yoy.
Aaron Francis
No, no, no, I don't like it.
Joe Tannenbaum
You don't like this?
Aaron Francis
I don't like it.
Joe Tannenbaum
Okay, how do you wanna do it?
Aaron Francis
What if we do... What if we h- what if we set, uh, what if we set when the scroll index is negative one, it's in live mode?
Joe Tannenbaum
Well, 'cause we need the scroll index to show where the scroll bar is on the s- on the scrolling. That needs to be set correctly. We can, we can have a Boolean that says, like, we're in live mode or we're not in live mode, right?
Aaron Francis
Well, if we follow that through and we come to the renderer, where do we take the index? Um, if start equals negative one, start equals... What, what would be the last line, basically?
Joe Tannenbaum
Hmm. Okay. Yeah. Um-
Aaron Francis
Well, what would be the max? So if we come over here, what is the max? The max is max lines less scroll panel height-
Joe Tannenbaum
Yeah
Aaron Francis
... which we have. Does this feel weird?
Joe Tannenbaum
I think where you're gonna run into trouble is as soon as you start scrolling, w- what does that look like? I.e., like, okay, so it's at negative one now, and I've s- I now scroll-
Aaron Francis
Uh-huh
Joe Tannenbaum
... up. And so I have to then check, are we at negative one?
Aaron Francis
Oh, you gotta check for negative one everywhere.
Joe Tannenbaum
Set it... Set, yeah, negative one becomes this weird flag that we have to set everywhere or we have to check for everywhere in order to-
Aaron Francis
Yep
Joe Tannenbaum
... understand what the index should be.
Aaron Francis
Yep, yep, yep, yep, yep, yep, yep.
Joe Tannenbaum
Um...
Aaron Francis
All right, let's do the Boolean style.
Joe Tannenbaum
I mean, I don't really love the Boolean either- ... but we can start there and see if it, like, it, we can get it to work correctly at the very least.
Aaron Francis
Well, I don't like, I don't like the idea of messing about with-
Joe Tannenbaum
It knows too much in there. Yeah, yeah, yeah.
Aaron Francis
Yeah.
Joe Tannenbaum
Uh, well, we can, well, we can... I don't know how this is all set up, but w- who's calling onTick in here? Are you calling onTick in the dev command?
Aaron Francis
I think you're calling onTick. UseTick-
Joe Tannenbaum
Oh, is this just a loopable?
Aaron Francis
... is a loopable. Mm-hmm. So every tick it sh- sees if the command is trying to stop, otherwise it gathers up the latest output since the last tick. No good?
Joe Tannenbaum
No, it's fine. I just, uh, I was trying to, I was trying to delegate the responsibility elsewhere, but we're not in direct control of... Like, this doesn't know about the dev command, right?
Aaron Francis
Correct.
Joe Tannenbaum
Or does it?
Aaron Francis
Correct.
Joe Tannenbaum
Hmm. That's tricky. Um, well, this is-
Aaron Francis
So here's-
Joe Tannenbaum
... becoming a not 10-minute thing.
Aaron Francis
Well, and we're already, like, six minutes into your 10. So we got four-
Joe Tannenbaum
Yeah
Aaron Francis
... minutes left. Um, so let's program by wishful thinking and say that here we want, um, we're just gonna say pause and-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... live. Um, and then we'll come over here. Where are you? We're gonna say restart. These all need to be cleaned up just a little bit. We'll say pause and live. And-
Joe Tannenbaum
I mean, technically you could, you could, uh, make that one hotkey that, that switches based on what you're actually in, but that's for later.
Aaron Francis
Hmm. I like that. Combine based on state. Um-
Joe Tannenbaum
Well, that, that one is-
Aaron Francis
What about that?
Joe Tannenbaum
Yeah. This I, this I dig. I dig. I like.
Aaron Francis
Okay. Okay.
Joe Tannenbaum
Yep. Yep. Uh-huh. Uh-huh.
Aaron Francis
Hey, newness here. Um, current command is a dev command. And so then if we come over here and we say we got scroll down, we got scroll up. What if we said, um, we just want... Then the question is, what do we do in here?
Joe Tannenbaum
Well, if we s- if we say, like, set a flag to say what mode we're in.
Aaron Francis
Mm-hmm. Okay. I like the word mode. That seems cool.
Joe Tannenbaum
Yeah. Um.
Aaron Francis
No need to have random-
Joe Tannenbaum
Oh
Aaron Francis
... strings. We can just say-
Joe Tannenbaum
Wait. Um-
Aaron Francis
Oh, go on
Joe Tannenbaum
... no, keep it. No, need, just keep... What was your thought?
Aaron Francis
I was gonna say, no need to have random strings. We can just have a Boolean, right?
Joe Tannenbaum
Okay. Here, here, here's the thing that we can, here's the thing that we can do.
Aaron Francis
Yeah.
Joe Tannenbaum
Great.
Aaron Francis
Tell me.
Joe Tannenbaum
We're here.
Aaron Francis
Yeah.
Joe Tannenbaum
Uh, let me, let me type for a second. Let me just see if we got-
Aaron Francis
Oh, drive, baby. Let's see it
Joe Tannenbaum
... uh, uh, pet function. Uh, catch... I'm just gonna call this catch up scroll for right now.
Aaron Francis
Okay.
Joe Tannenbaum
And this is void, and it's just gonna s- oh, my God, this is killing me. I don't know how-
Aaron Francis
I know. I'm so sorry
Joe Tannenbaum
... you do it. That's okay. If, uh, we can say, whoops, if this... There's just an immense amount of lag, so I can't see what I'm typing in real time. Uh, basically what we're gonna do is set this scroll index equal to, uh, uh, uh, uh, uh, um, this rat...
Oh, no, it's component. This component Uh, don't enter wrapped lines-
Aaron Francis
Mm-hmm. Mm-hmm. Mm-hmm
Joe Tannenbaum
... count minus this. What, what was the vis- uh...
Aaron Francis
I can scroll down. Hang on.
Joe Tannenbaum
What was the thing? I don't remember what the thing was. Yeah. So, and just for n- right now we'll just grab-
Aaron Francis
Yeah
Joe Tannenbaum
... this here.
Aaron Francis
We'll fix, fix all this later. This, this-
Joe Tannenbaum
Yeah. This'll, this'll be nicer, nicer later. Um, and then when we loop, uh, go back to the loop, the main loop. Oh, I think I missed a semicolon here. Sorry.
Aaron Francis
Yeah. Let me grab something fast. So we'll do this, and then we need to add, uh, we need to add public bool paused equal false.
Joe Tannenbaum
And if we go back to the main loop-
Aaron Francis
The loopable
Joe Tannenbaum
... and then we go... No, the main loop in the, in the app state.
Aaron Francis
I don't know what the main loop in the app state-
Joe Tannenbaum
Sorry, right there. Yeah, dashboard.
Aaron Francis
Renderer? Sorry. Renderer?
Joe Tannenbaum
Um, being... No, just the regular dashboard.
Aaron Francis
Okay.
Joe Tannenbaum
Sorry, I'm being massively unclear. Go down to where the loop method, which is right there.
Aaron Francis
Oh, yeah. Okay.
Joe Tannenbaum
And now we can say, we can grab this, and we can say boop, and we can say catch up scroll here.
Aaron Francis
What?
Joe Tannenbaum
And now-
Aaron Francis
What?
Joe Tannenbaum
... I think, I think this m- might do it, and I don't know, but, like, let's just, let's just rip it.
Aaron Francis
Okay. Tell me-
Joe Tannenbaum
Let's go
Aaron Francis
... what you've just done. So you, let's just... We've done this.
Joe Tannenbaum
So-
Aaron Francis
You've done def main.
Joe Tannenbaum
So as we loop through-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... as we loop through, we are saying, "If it's not paused, set the scroll index to the last scroll index that's possible," meaning, like, we want the live feed of it, okay? So every time we loop through-
Aaron Francis
Oh
Joe Tannenbaum
... we're gonna set it to the last one. But if we're not paused, we can scroll as we wish.
Aaron Francis
Oh. Okay, so let's do this. Um, we can comment out that.
Joe Tannenbaum
So in terms of a usability thing that we can flag for later-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... you should disable manual scrolling if you are in paused mode, because it, otherwise it's gonna constantly fight you to be down instead of being, allow you to scroll through the thing. You could also say, "As soon as we scroll, put it in pause mode." That could also be a thing that you do. But-
Aaron Francis
Yeah
Joe Tannenbaum
... neither here nor there.
Aaron Francis
Yeah.
Joe Tannenbaum
Okay, let's try it.
Aaron Francis
All right. All right, so we're just, like, we're cruising.
Joe Tannenbaum
Yeah.
Aaron Francis
Uh, it's getting a little weird. Don't know where that's coming from.
Joe Tannenbaum
I think it's because we're getting mixed, um... You need to clean up the output that's coming in, because you're getting, I think, chunks of... Like, meaning when you're tailing, you're getting, you're not getting clean output back, I think is what I'm saying.
Aaron Francis
Let's do that.
Joe Tannenbaum
My goodness, what is happening now?
Aaron Francis
I do not know. But if we hit pause, it did pause.
Joe Tannenbaum
Okay. And if we hit L, does it go back? Yep.
Aaron Francis
And if you hit L, hey, I think that works.
Joe Tannenbaum
All right. It's something. It's just a little, something's off here. There's, like, something to-
Aaron Francis
There's, I think there's something off-
Joe Tannenbaum
... fix
Aaron Francis
... with, like, the actual command.
Joe Tannenbaum
Yeah. Something, something's wrong. I'm not really sure what it is, but I have to-
Aaron Francis
I'm not either. But this is good, because if we pause it, if we pause it, we can actually scroll up. Who knows why they're interleaved like that.
Joe Tannenbaum
Yeah.
Aaron Francis
Um, and then if we hit live, it pops back down to the bottom. So there's likely-
Joe Tannenbaum
We'll take it
Aaron Francis
... a-
Joe Tannenbaum
It... Some-
Aaron Francis
Oh
Joe Tannenbaum
... something about the way this is coming in.
Aaron Francis
No, no, no. This person is totally right. Who is that? Chris. Chris on YouTube is totally right. I am starting this command twice.
Joe Tannenbaum
Oh. Oh. Oh.
Aaron Francis
No, no, no, no. Don't... No, no, no. That's, no, no. Don't laugh at me. Don't laugh at me. No, no, no. That's not on me. Well, you should've caught that. You sh- you should-
Joe Tannenbaum
Oh, man. That's hilarious
Aaron Francis
... you should've seen that. All right. All right. Forget that that ever happened. We're back, baby. We're back.
Joe Tannenbaum
Okay. It's still doing something so weird, and I don't know what that is. What is, what is happening here?
Aaron Francis
But it worked kind of.
Joe Tannenbaum
It kinda worked.
Aaron Francis
Oh, now, now it's not pausing anymore. Okay. That's it. We're done. That was 10 minutes.
Joe Tannenbaum
Okay.
Aaron Francis
We're close.
Joe Tannenbaum
Thank you. This was fun. This was fun.
Aaron Francis
This was great.
Joe Tannenbaum
We got, we got into a place where it's like, okay, we can play in this pl- this space a little bit.
Aaron Francis
Yes.
Joe Tannenbaum
That's not bad.
Aaron Francis
So there's a lot to clean up. Um, for those of you watching, you need to go find... Well, there they are. You need to go find Jess Archer-
Joe Tannenbaum
Jess Archer, for sure
Aaron Francis
... who's created Prompts underneath, and you need to go find Joe Tiemanbaum, who created-
Joe Tannenbaum
Tiemanbaum
Aaron Francis
... Chewy on top. Both-
Joe Tannenbaum
Yeah
Aaron Francis
... Laravel employees. Um, and also, while we're here, did you see this? Does, does this speak to-
Joe Tannenbaum
I didn't wanna-
Aaron Francis
... your Chewy heart?
Joe Tannenbaum
I didn't wanna... I...
Aaron Francis
I appreciate the respect.
Joe Tannenbaum
I saw it yesterday, and I was like, the urge to tweet this is so strong-
Aaron Francis
I know
Joe Tannenbaum
... because it really-
Aaron Francis
No
Joe Tannenbaum
... is fantastic.
Aaron Francis
Dude-
Joe Tannenbaum
But also, I can't, I cannot
Aaron Francis
... that's very, that's very thoughtful.
Joe Tannenbaum
I cannot.
Aaron Francis
You are free.
Joe Tannenbaum
But-
Aaron Francis
All of you are free to like Planet Scale. That is totally fine.
Joe Tannenbaum
The... Oh, I don't dislike them. I just, you know, eh, you know.
Aaron Francis
Yes. That's totally fine.
Joe Tannenbaum
Uh, I think this is-
Aaron Francis
Yeah. What do you think?
Joe Tannenbaum
... bold and fun and great, and I'm very, very into it. It's horrific on mobile right now, but it is great on desktop.
Aaron Francis
Oh, is that it?
Joe Tannenbaum
Um-
Aaron Francis
Is that true?
Joe Tannenbaum
It's probably a really hard thing to nail on mobile. I don't know.
Aaron Francis
This is some real-
Joe Tannenbaum
My, my phone lives-
Aaron Francis
... not real mobile
Joe Tannenbaum
... lives wild. Um-
Aaron Francis
Yeah.
Joe Tannenbaum
This is so cool. I think this is rad. I think this is really cool.
Aaron Francis
I immediately thought of you when I saw this.
Joe Tannenbaum
Yeah.
Aaron Francis
I thought-
Joe Tannenbaum
Yeah
Aaron Francis
... I thought, "Joe's, Joe's gonna like this."
Joe Tannenbaum
'Cause, like, nobody's doing anything even close like this right now.
Aaron Francis
No.
Joe Tannenbaum
Like, this is so bespoke and so nice, and I think it's V-- I think it's fantastic. I'm so into it.
Aaron Francis
I have questions about whether this will convert. Um, like is, does this serve the business needs? But-
Joe Tannenbaum
That's a whole lot of not my problem, but-
Aaron Francis
Yeah.
Joe Tannenbaum
Yeah. I, I, I agree. I agree.
Aaron Francis
Honestly, a lot of not my problem now, too.
Joe Tannenbaum
Yeah. Yeah. Uh, but I respect the, I respect the big swing, and I think it's-- I, uh, for me, it's working. I think it's great. Wow, they really minified the heck out of that, huh?
Aaron Francis
They sure did.
Joe Tannenbaum
Uh, but then they have to pre all this stuff 'cause it's literally just text. That's amazing.
Aaron Francis
And then it's also Remix. It's amazing.
Joe Tannenbaum
Oh, boy.
Aaron Francis
Yeah. Anyway, I thought of you. I don't... I, I will withhold all opinions, but I thought of you when I saw this.
Joe Tannenbaum
I am a fan.
Aaron Francis
Just gonna leave it.
Joe Tannenbaum
I'm a big fan.
Aaron Francis
Yeah.
Joe Tannenbaum
Yeah.
Aaron Francis
Good for-
Joe Tannenbaum
Yeah
Aaron Francis
... good for you.
Joe Tannenbaum
For sure.
Aaron Francis
Good for them. All right. Thanks for doing this.
Joe Tannenbaum
Uh, dude, thank you. It's a pleasure.
Aaron Francis
Super fun. Yeah. Y'all, thanks for hanging out. I will, um... So here's last question, Joe. Do you think this is, do you think this is, uh, usable? Like, not right now, but as a concept, having all of this running versus NPX concurrently?
Joe Tannenbaum
Um, when Taylor first showed us this a couple weeks ago or whenever it was-
Aaron Francis
Mm-hmm
Joe Tannenbaum
... uh, he would, like, put it in the Slack channel. He's like, "What do you think?" I was like, "This feels like it should be a two-way probably."
Aaron Francis
Come on. Hey.
Joe Tannenbaum
It feels like exactly kind of what you're building.
Aaron Francis
Yeah.
Joe Tannenbaum
Like... And I was like, "Is this why I was hired? Is this the reason that we-"
Aaron Francis
Yeah
Joe Tannenbaum
"... finally gotten here?" Um, I think that-- Here's, here's what I think. I think it's a, actually a better user experience than the concurrently, in my opinion.
Aaron Francis
Uh-huh. Uh-huh.
Joe Tannenbaum
I don't like that it's really all mixed together. Um-
Aaron Francis
I don't either. Hate that
Joe Tannenbaum
... it feels less, like, parsable to me.
Aaron Francis
Uh-huh.
Joe Tannenbaum
But, um, the difficulty of getting it exactly right, the types-
Aaron Francis
Uh-huh
Joe Tannenbaum
... of stuff that are going to be coming through the pipe in these streams-
Aaron Francis
Yeah
Joe Tannenbaum
... is hard. And making it right across, especially different terminals, is very difficult.
Aaron Francis
Mm-hmm.
Joe Tannenbaum
That being said, I think tabs is a, you know, 100X experience over, over the-- Like, this is a big leap forward. I like that, like, you can just start the whole process in one fell swoop. I do love that.
Aaron Francis
Yeah.
Joe Tannenbaum
I just think that the output is not, um, as, as parsable as I would like it to be, considering it's important stuff that I need to look at. You know what I mean?
Aaron Francis
Yes. Okay.
Joe Tannenbaum
So I think it's a step in the right direction.
Aaron Francis
Like, I don't wanna see, I don't wanna see Veet constantly spamming stuff when I'm trying to find logs, and that's the problem-
Joe Tannenbaum
Yeah
Aaron Francis
... in my opinion, with NPX concurrently, is-
Joe Tannenbaum
Yeah
Aaron Francis
... like, the, the relative weight of importance is all set to equal, and it's like, that's just-
Joe Tannenbaum
Mm-hmm
Aaron Francis
... noisy, and so I don't like that.
Joe Tannenbaum
Mm-hmm.
Aaron Francis
Okay, cool.
Joe Tannenbaum
That's my, that's my feeling as well.
Aaron Francis
Well, I will get this polished up, and then, uh, we'll release it open source, and we'll let the people fix all the bugs. Isn't that how it works?
Joe Tannenbaum
That's how it works. That's how it works.
Aaron Francis
And if anybody, if anybody ends up using it, they have to pay me 8% of their revenue, so-
Joe Tannenbaum
There it is
Aaron Francis
... hey, we're just having fun.
Joe Tannenbaum
There it is.
Aaron Francis
We're just having fun. All right. Thanks, y'all. Thank you, Joe-
Joe Tannenbaum
All right, dude
Aaron Francis
... for doing this. We'll talk soon. See y'all later.
Joe Tannenbaum
See you later.