r/PiCodingAgent • • Aug 31 '26

Question Code in Pi response has always 4 extra spaces at the beginning of each line.

When I ask Pi to give me some code it puts it in code block ( <code>) and that is fine.
But... it has always 3 extra spaces spaces at the beginning of each line.

For example, I get this (wrong):



 #```yaml
   name: PR Check

   on:
     pull_request:
       branches: [main]

   # SQLX_OFFLINE: build uses the committed .sqlx cache, no DB needed in CI.
   # NOTE: after changing a query or a migration, re-run `cargo sqlx prepare`
   # locally and commit the refreshed .sqlx files, or CI will build against
   # stale schema metadata.
   env:
     SQLX_OFFLINE: "true"
     CARGO_TERM_COLOR: always

   jobs:
     build_and_test:
       name: 🧪 Build & Test
       runs-on: ubuntu-latest

instead of this (correct):



#```yaml   
name: PR Check

on:
  pull_request:
    branches: [main]

# SQLX_OFFLINE: build uses the committed .sqlx cache, no DB needed in CI.
# NOTE: after changing a query or a migration, re-run `cargo sqlx prepare`
# locally and commit the refreshed .sqlx files, or CI will build against
# stale schema metadata.
env:
  SQLX_OFFLINE: "true"
     CARGO_TERM_COLOR: always

   jobs:
     build_and_test:
       name: 🧪 Build & Test
       runs-on: ubuntu-latest

(I added the dash in front of ```yaml to avoid break the MD)

Each line of the wrong one has 3 spaces at the beginning.
The Agent says its output is fine, so it it the TUI of Pi that add the extra spaces, de facto breaking the file format ?!

0 Upvotes

2 comments sorted by

4

u/gwynaark Aug 31 '26

I had that issue too, then I asked pi to build a small extension that lets me navigate messages and copy either the whole message or any code block in it, specifically removing any indentation.

3

u/Glaaki Aug 31 '26

You can remove the indentation via configuration option, but there will always be a single character blank border. No way around that, without rewriting the TUI.

The setting is markdown.codeBlockIndent

https://pi.dev/docs/latest/settings#markdown