<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue" -->

---
title: 2 off by 1s make a right | daily.dev
description: A live coding session focused on improving a custom GUI framework&#x27;s textbox widget, built from scratch in Zig. The developer works through several bugs: fixing...
canonical: https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: 2 off by 1s make a right | daily.dev
og:description: A live coding session focused on improving a custom GUI framework&#x27;s textbox widget, built from scratch in Zig. The developer works through several bugs: fixing...
og:url: https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue
og:image: https://api.daily.dev/og/posts/j0Va6miuE.png
og:image:alt: 2 off by 1s make a right
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 2 off by 1s make a right

**[sphaerophoria](https://daily.dev/sources/sphaerophoria)** · 122 min read · 0 upvotes · 0 comments

## Summary

A live coding session focused on improving a custom GUI framework's textbox widget, built from scratch in Zig. The developer works through several bugs: fixing cursor overflow past the right edge of the textbox, centering the cursor correctly between characters using inclusive/exclusive pixel boundary math, making clicks outside text jump the cursor to the correct position, and implementing smooth drift-based text scrolling when dragging the mouse outside the widget bounds. The session involves significant off-by-one debugging around pixel-level cursor placement and integer truncation bias.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=v8jTgaVmp5U>

---

Tags: [#zig](https://daily.dev/tags/zig)

[View this post on daily.dev](https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"2 off by 1s make a right","url":"https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue"},"datePublished":"2026-06-05T22:57:45.823Z","dateModified":"2026-06-05T23:23:35.396Z","description":"A live coding session focused on improving a custom GUI framework's textbox widget, built from scratch in Zig. The developer works through several bugs: fixing...","image":"https://i.ytimg.com/vi/v8jTgaVmp5U/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/v8jTgaVmp5U/sddefault.jpg","isAccessibleForFree":true,"articleSection":"sphaerophoria","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"sphaerophoria","logo":"https://media.daily.dev/image/upload/s--dgPUg2T7--/f_auto/v1728806109/logos/sphaerophoria","url":"https://daily.dev/sources/sphaerophoria"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/2-off-by-1s-make-a-right-j0va6miue","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"zig","timeRequired":"PT122M","video":{"@type":"VideoObject","name":"2 off by 1s make a right","description":"A live coding session focused on improving a custom GUI framework's textbox widget, built from scratch in Zig. The developer works through several bugs: fixing...","thumbnailUrl":"https://i.ytimg.com/vi/v8jTgaVmp5U/sddefault.jpg","uploadDate":"2026-06-05T22:57:45.823Z","duration":"PT122M","url":"https://api.daily.dev/r/j0Va6miuE","embedUrl":"https://www.youtube.com/embed/v8jTgaVmp5U"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"sphaerophoria","item":"https://daily.dev/sources/sphaerophoria"},{"@type":"ListItem","position":3,"name":"2 off by 1s make a right"}]}
```

